diff --git a/TASVideos/Pages/Flags/Index.cshtml b/TASVideos/Pages/Flags/Index.cshtml index f79cbf0f3..df421cca6 100644 --- a/TASVideos/Pages/Flags/Index.cshtml +++ b/TASVideos/Pages/Flags/Index.cshtml @@ -15,7 +15,7 @@ Permission Restriction - @foreach (var flag in Model.Flags) + @foreach (var flag in Model.Flags.OrderBy(f => f.Token)) { @flag.Name diff --git a/TASVideos/Pages/Flags/Index.cshtml.cs b/TASVideos/Pages/Flags/Index.cshtml.cs index 25e1cec2d..40c825219 100644 --- a/TASVideos/Pages/Flags/Index.cshtml.cs +++ b/TASVideos/Pages/Flags/Index.cshtml.cs @@ -10,8 +10,6 @@ public class IndexModel(IFlagService flagService) : BasePageModel public async Task OnGet() { - Flags = (await flagService.GetAll()) - .OrderBy(t => t.Token) - .ToList(); + Flags = await flagService.GetAll(); } } diff --git a/TASVideos/Pages/Forum/Models/CategoryEditModel.cs b/TASVideos/Pages/Forum/Models/CategoryEditModel.cs index 2a4ed1d06..2fe414474 100644 --- a/TASVideos/Pages/Forum/Models/CategoryEditModel.cs +++ b/TASVideos/Pages/Forum/Models/CategoryEditModel.cs @@ -9,7 +9,7 @@ public class CategoryEditModel public string? Description { get; set; } - public IList Forums { get; set; } = []; + public List Forums { get; set; } = []; public class ForumEditModel { diff --git a/TASVideos/Pages/Forum/Posts/Create.cshtml.cs b/TASVideos/Pages/Forum/Posts/Create.cshtml.cs index 4ef994fc2..dcae7ff46 100644 --- a/TASVideos/Pages/Forum/Posts/Create.cshtml.cs +++ b/TASVideos/Pages/Forum/Posts/Create.cshtml.cs @@ -32,7 +32,7 @@ public class CreateModel( [DisplayName("Watch Topic for Replies")] public bool WatchTopic { get; set; } - public IEnumerable PreviousPosts { get; set; } = []; + public List PreviousPosts { get; set; } = []; public AvatarUrls UserAvatars { get; set; } = new(null, null); diff --git a/TASVideos/Pages/Forum/Posts/Edit.cshtml.cs b/TASVideos/Pages/Forum/Posts/Edit.cshtml.cs index 4507bc923..50d5c08df 100644 --- a/TASVideos/Pages/Forum/Posts/Edit.cshtml.cs +++ b/TASVideos/Pages/Forum/Posts/Edit.cshtml.cs @@ -31,7 +31,7 @@ public class EditModel( [BindProperty] [DisplayName("Minor Edit")] public bool MinorEdit { get; set; } - public IEnumerable PreviousPosts { get; set; } = []; + public List PreviousPosts { get; set; } = []; public AvatarUrls UserAvatars { get; set; } = new(null, null); diff --git a/TASVideos/Pages/Forum/Posts/User.cshtml.cs b/TASVideos/Pages/Forum/Posts/User.cshtml.cs index 9349ac243..31ba22272 100644 --- a/TASVideos/Pages/Forum/Posts/User.cshtml.cs +++ b/TASVideos/Pages/Forum/Posts/User.cshtml.cs @@ -24,7 +24,7 @@ public class UserModel( public PageOf Posts { get; set; } = PageOf.Empty(); - public IEnumerable Awards { get; set; } = []; + public List Awards { get; set; } = []; public async Task OnGet() { diff --git a/TASVideos/Pages/Forum/Subforum/Create.cshtml.cs b/TASVideos/Pages/Forum/Subforum/Create.cshtml.cs index 1a99bcf82..9992774b5 100644 --- a/TASVideos/Pages/Forum/Subforum/Create.cshtml.cs +++ b/TASVideos/Pages/Forum/Subforum/Create.cshtml.cs @@ -12,7 +12,7 @@ public class CreateModel(ApplicationDbContext db) : BasePageModel [BindProperty] public ForumEditModel Forum { get; set; } = new(); - public IEnumerable AvailableCategories { get; set; } = []; + public List AvailableCategories { get; set; } = []; public async Task OnGet() { diff --git a/TASVideos/Pages/Forum/Subforum/Edit.cshtml.cs b/TASVideos/Pages/Forum/Subforum/Edit.cshtml.cs index 858c98a6b..c30be93dd 100644 --- a/TASVideos/Pages/Forum/Subforum/Edit.cshtml.cs +++ b/TASVideos/Pages/Forum/Subforum/Edit.cshtml.cs @@ -18,7 +18,7 @@ public class EditModel(ApplicationDbContext db) : BasePageModel public bool CanDelete { get; set; } - public IEnumerable AvailableCategories { get; set; } = []; + public List AvailableCategories { get; set; } = []; public async Task OnGet() { diff --git a/TASVideos/Pages/Forum/Topics/Catalog.cshtml.cs b/TASVideos/Pages/Forum/Topics/Catalog.cshtml.cs index bc5ea4e44..ba3db0cfa 100644 --- a/TASVideos/Pages/Forum/Topics/Catalog.cshtml.cs +++ b/TASVideos/Pages/Forum/Topics/Catalog.cshtml.cs @@ -13,9 +13,9 @@ public class CatalogModel(ApplicationDbContext db) : BasePageModel [FromRoute] public int Id { get; set; } - public IEnumerable AvailableSystems { get; set; } = []; + public List AvailableSystems { get; set; } = []; - public IEnumerable AvailableGames { get; set; } = []; + public List AvailableGames { get; set; } = []; [BindProperty] public string Title { get; set; } = ""; @@ -86,22 +86,30 @@ public async Task OnPost() private async Task Initialize() { - AvailableSystems = UiDefaults.DefaultEntry.Concat(await db.GameSystems - .OrderBy(s => s.Code) - .Select(s => new SelectListItem - { - Value = s.Id.ToString(), - Text = s.Code - }) - .ToListAsync()); + AvailableSystems = + [ + .. UiDefaults.DefaultEntry, + .. await db.GameSystems + .OrderBy(s => s.Code) + .Select(s => new SelectListItem + { + Value = s.Id.ToString(), + Text = s.Code + }) + .ToListAsync(), + ]; if (SystemId.HasValue) { - AvailableGames = UiDefaults.DefaultEntry.Concat(await db.Games - .ForSystem(SystemId.Value) - .OrderBy(g => g.DisplayName) - .ToDropDown() - .ToListAsync()); + AvailableGames = + [ + .. UiDefaults.DefaultEntry, + .. await db.Games + .ForSystem(SystemId.Value) + .OrderBy(g => g.DisplayName) + .ToDropDown() + .ToListAsync(), + ]; } } } diff --git a/TASVideos/Pages/Forum/Topics/Merge.cshtml.cs b/TASVideos/Pages/Forum/Topics/Merge.cshtml.cs index 92aa20498..8837891d4 100644 --- a/TASVideos/Pages/Forum/Topics/Merge.cshtml.cs +++ b/TASVideos/Pages/Forum/Topics/Merge.cshtml.cs @@ -22,9 +22,9 @@ public class MergeModel( [BindProperty] public MergeTopicModel Topic { get; set; } = new(); - public IEnumerable AvailableForums { get; set; } = []; + public List AvailableForums { get; set; } = []; - public IEnumerable AvailableTopics { get; set; } = []; + public List AvailableTopics { get; set; } = []; private bool CanSeeRestricted => User.Has(PermissionTo.SeeRestrictedForums); @@ -135,7 +135,7 @@ private async Task PopulateAvailableForums() }) .ToListAsync(); - AvailableTopics = UiDefaults.DefaultEntry.Concat(await GetTopicsForForum(Topic.ForumId)); + AvailableTopics = [.. UiDefaults.DefaultEntry, .. await GetTopicsForForum(Topic.ForumId)]; } private async Task> GetTopicsForForum(int forumId) diff --git a/TASVideos/Pages/Forum/Topics/Models/MoveTopicModel.cs b/TASVideos/Pages/Forum/Topics/Models/MoveTopicModel.cs index 3763b8ab6..32a823f55 100644 --- a/TASVideos/Pages/Forum/Topics/Models/MoveTopicModel.cs +++ b/TASVideos/Pages/Forum/Topics/Models/MoveTopicModel.cs @@ -5,11 +5,11 @@ namespace TASVideos.Pages.Forum.Topics.Models; public class MoveTopicModel { [Display(Name = "New Forum")] - public int ForumId { get; set; } + public int ForumId { get; init; } [Display(Name = "Topic")] - public string TopicTitle { get; set; } = ""; + public string TopicTitle { get; init; } = ""; [Display(Name = "Current Forum")] - public string ForumName { get; set; } = ""; + public string ForumName { get; init; } = ""; } diff --git a/TASVideos/Pages/Forum/Topics/Models/PollCreateModel.cs b/TASVideos/Pages/Forum/Topics/Models/PollCreateModel.cs index bb889615a..26d399ce5 100644 --- a/TASVideos/Pages/Forum/Topics/Models/PollCreateModel.cs +++ b/TASVideos/Pages/Forum/Topics/Models/PollCreateModel.cs @@ -16,7 +16,7 @@ public class PollCreateModel public bool MultiSelect { get; set; } [Display(Name = "Options")] - public IList PollOptions { get; set; } = ["", ""]; + public List PollOptions { get; set; } = ["", ""]; public bool IsValid => !string.IsNullOrWhiteSpace(Question) diff --git a/TASVideos/Pages/Forum/Topics/Models/PollResultModel.cs b/TASVideos/Pages/Forum/Topics/Models/PollResultModel.cs index 1d03dba26..c29505499 100644 --- a/TASVideos/Pages/Forum/Topics/Models/PollResultModel.cs +++ b/TASVideos/Pages/Forum/Topics/Models/PollResultModel.cs @@ -9,7 +9,7 @@ public class PollResultModel public string Question { get; set; } = ""; - public IEnumerable Votes { get; set; } = []; + public List Votes { get; set; } = []; public class VoteResult { diff --git a/TASVideos/Pages/Forum/Topics/Models/SplitTopicModel.cs b/TASVideos/Pages/Forum/Topics/Models/SplitTopicModel.cs index cfa5523fa..3ca240300 100644 --- a/TASVideos/Pages/Forum/Topics/Models/SplitTopicModel.cs +++ b/TASVideos/Pages/Forum/Topics/Models/SplitTopicModel.cs @@ -18,7 +18,7 @@ public class SplitTopicModel public int ForumId { get; set; } public string ForumName { get; set; } = ""; - public IList Posts { get; set; } = []; + public List Posts { get; set; } = []; public class Post { diff --git a/TASVideos/Pages/Forum/Topics/Move.cshtml.cs b/TASVideos/Pages/Forum/Topics/Move.cshtml.cs index cdced52a6..0be6a1b9a 100644 --- a/TASVideos/Pages/Forum/Topics/Move.cshtml.cs +++ b/TASVideos/Pages/Forum/Topics/Move.cshtml.cs @@ -22,7 +22,7 @@ public class MoveModel( [BindProperty] public MoveTopicModel Topic { get; set; } = new(); - public IEnumerable AvailableForums { get; set; } = []; + public List AvailableForums { get; set; } = []; public bool CanSeeRestricted => User.Has(PermissionTo.SeeRestrictedForums); diff --git a/TASVideos/Pages/Forum/Topics/Split.cshtml.cs b/TASVideos/Pages/Forum/Topics/Split.cshtml.cs index 9fce8f078..e1d1fd41c 100644 --- a/TASVideos/Pages/Forum/Topics/Split.cshtml.cs +++ b/TASVideos/Pages/Forum/Topics/Split.cshtml.cs @@ -22,7 +22,7 @@ public class SplitModel( [BindProperty] public SplitTopicModel Topic { get; set; } = new(); - public IEnumerable AvailableForums { get; set; } = []; + public List AvailableForums { get; set; } = []; private bool CanSeeRestricted => User.Has(PermissionTo.SeeRestrictedForums); diff --git a/TASVideos/Pages/GameGroups/Index.cshtml.cs b/TASVideos/Pages/GameGroups/Index.cshtml.cs index 98ca040e9..27b9f1491 100644 --- a/TASVideos/Pages/GameGroups/Index.cshtml.cs +++ b/TASVideos/Pages/GameGroups/Index.cshtml.cs @@ -14,7 +14,7 @@ public class IndexModel(ApplicationDbContext db) : BasePageModel public int ParsedId => int.TryParse(Id, out var id) ? id : -1; - public IEnumerable Games { get; set; } = []; + public List Games { get; set; } = []; public string Name { get; set; } = ""; public string? Description { get; set; } diff --git a/TASVideos/Pages/GameGroups/List.cshtml.cs b/TASVideos/Pages/GameGroups/List.cshtml.cs index 88903904d..6b80f6f04 100644 --- a/TASVideos/Pages/GameGroups/List.cshtml.cs +++ b/TASVideos/Pages/GameGroups/List.cshtml.cs @@ -6,7 +6,7 @@ namespace TASVideos.Pages.GameGroups; [AllowAnonymous] public class ListModel(ApplicationDbContext db) : BasePageModel { - public IEnumerable GameGroups { get; set; } = []; + public List GameGroups { get; set; } = []; public async Task OnGet() {