upgrade to .net 8

This commit is contained in:
2024-10-12 14:34:11 +08:00
parent 7a44b7fd9c
commit c914f13828
15 changed files with 384 additions and 393 deletions

View File

@@ -12,12 +12,8 @@ namespace Blahblah.FlowerStory.Server.Controller;
[ApiController]
[Produces("application/json")]
[Route("api/event")]
public class EventApiController : BaseController
public class EventApiController(FlowerDatabase database, ILogger<EventApiController>? logger = null) : BaseController<EventApiController>(database, logger)
{
/// <inheritdoc/>
public EventApiController(FlowerDatabase database, ILogger<BaseController>? logger = null) : base(database, logger)
{
}
/// <summary>
/// 获取符合条件的公共事件
@@ -93,8 +89,8 @@ public class EventApiController : BaseController
if (key != null)
{
records = records.Where(r =>
r.ByUserName != null && r.ByUserName.ToLower().Contains(key.ToLower()) ||
r.Memo != null && r.Memo.ToLower().Contains(key.ToLower()));
r.ByUserName != null && r.ByUserName.Contains(key, StringComparison.CurrentCultureIgnoreCase) ||
r.Memo != null && r.Memo.Contains(key, StringComparison.CurrentCultureIgnoreCase));
}
if (from != null)
{
@@ -208,7 +204,7 @@ public class EventApiController : BaseController
if (includePhoto == true)
{
item.Photos = database.Photos.Where(p => p.RecordId == item.Id).ToList();
item.Photos = [.. database.Photos.Where(p => p.RecordId == item.Id)];
foreach (var photo in item.Photos)
{
photo.Url = $"photo/flower/{item.FlowerId}/{photo.Path}";
@@ -270,7 +266,7 @@ public class EventApiController : BaseController
/// <remarks>
/// 请求示例:
///
/// POST /api/event/remove
/// POST /api/event/removeany
/// Authorization: authorization id
/// [
/// 2, 4, 5, 11