Minor cleanup
This commit is contained in:
@@ -44,7 +44,6 @@ public class CountriesController : Controller
|
|||||||
public async Task<IActionResult> Row(string id)
|
public async Task<IActionResult> Row(string id)
|
||||||
{
|
{
|
||||||
var country = await ctx.Countries
|
var country = await ctx.Countries
|
||||||
.AsNoTracking()
|
|
||||||
.Select(c => new CountryViewModel
|
.Select(c => new CountryViewModel
|
||||||
{
|
{
|
||||||
Code = c.Code,
|
Code = c.Code,
|
||||||
@@ -196,7 +195,6 @@ public class CountriesController : Controller
|
|||||||
var nameFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "Name");
|
var nameFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "Name");
|
||||||
|
|
||||||
var baseQuery = ctx.Countries
|
var baseQuery = ctx.Countries
|
||||||
.AsNoTracking()
|
|
||||||
.Select(c => new CountryViewModel
|
.Select(c => new CountryViewModel
|
||||||
{
|
{
|
||||||
Code = c.Code,
|
Code = c.Code,
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class EventsController : Controller
|
|||||||
public async Task<IActionResult> Row(int id)
|
public async Task<IActionResult> Row(int id)
|
||||||
{
|
{
|
||||||
var eventModel = await ctx.Events
|
var eventModel = await ctx.Events
|
||||||
.AsNoTracking()
|
|
||||||
.Select(e => new EventViewModel
|
.Select(e => new EventViewModel
|
||||||
{
|
{
|
||||||
Id = e.Id,
|
Id = e.Id,
|
||||||
@@ -66,7 +65,6 @@ public class EventsController : Controller
|
|||||||
public async Task<IActionResult> EditRow(int id)
|
public async Task<IActionResult> EditRow(int id)
|
||||||
{
|
{
|
||||||
var eventModel = await ctx.Events
|
var eventModel = await ctx.Events
|
||||||
.AsNoTracking()
|
|
||||||
.Select(e => new EventViewModel
|
.Select(e => new EventViewModel
|
||||||
{
|
{
|
||||||
Id = e.Id,
|
Id = e.Id,
|
||||||
@@ -194,7 +192,6 @@ public class EventsController : Controller
|
|||||||
var nameFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "Name");
|
var nameFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "Name");
|
||||||
|
|
||||||
var baseQuery = ctx.Events
|
var baseQuery = ctx.Events
|
||||||
.AsNoTracking()
|
|
||||||
.Select(e => new EventViewModel
|
.Select(e => new EventViewModel
|
||||||
{
|
{
|
||||||
Id = e.Id,
|
Id = e.Id,
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ public class PeopleController : Controller
|
|||||||
public async Task<IActionResult> Row(int id)
|
public async Task<IActionResult> Row(int id)
|
||||||
{
|
{
|
||||||
var person = await ctx.People
|
var person = await ctx.People
|
||||||
.AsNoTracking()
|
|
||||||
.Select(p => new PersonViewModel
|
.Select(p => new PersonViewModel
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
@@ -85,7 +84,6 @@ public class PeopleController : Controller
|
|||||||
public async Task<IActionResult> EditRow(int id)
|
public async Task<IActionResult> EditRow(int id)
|
||||||
{
|
{
|
||||||
var person = await ctx.People
|
var person = await ctx.People
|
||||||
.AsNoTracking()
|
|
||||||
.Select(p => new PersonViewModel
|
.Select(p => new PersonViewModel
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
@@ -198,7 +196,6 @@ public class PeopleController : Controller
|
|||||||
await ctx.SaveChangesAsync();
|
await ctx.SaveChangesAsync();
|
||||||
|
|
||||||
var rowModel = await ctx.People
|
var rowModel = await ctx.People
|
||||||
.AsNoTracking()
|
|
||||||
.Where(p => p.Id == id)
|
.Where(p => p.Id == id)
|
||||||
.Select(p => new PersonViewModel
|
.Select(p => new PersonViewModel
|
||||||
{
|
{
|
||||||
@@ -263,7 +260,6 @@ public class PeopleController : Controller
|
|||||||
var countryFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "CountryCode", "==");
|
var countryFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "CountryCode", "==");
|
||||||
|
|
||||||
var baseQuery = ctx.People
|
var baseQuery = ctx.People
|
||||||
.AsNoTracking()
|
|
||||||
.Select(p => new PersonViewModel
|
.Select(p => new PersonViewModel
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
@@ -323,7 +319,6 @@ public class PeopleController : Controller
|
|||||||
private async Task<List<SelectListItem>> GetCountryOptionsAsync(string? selectedCode = null)
|
private async Task<List<SelectListItem>> GetCountryOptionsAsync(string? selectedCode = null)
|
||||||
{
|
{
|
||||||
return await ctx.Countries
|
return await ctx.Countries
|
||||||
.AsNoTracking()
|
|
||||||
.OrderBy(c => c.Name)
|
.OrderBy(c => c.Name)
|
||||||
.Select(c => new SelectListItem
|
.Select(c => new SelectListItem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ public class RegistrationsController : Controller
|
|||||||
public async Task<IActionResult> Row(int id, int eventId)
|
public async Task<IActionResult> Row(int id, int eventId)
|
||||||
{
|
{
|
||||||
var registration = await ctx.Registrations
|
var registration = await ctx.Registrations
|
||||||
.AsNoTracking()
|
|
||||||
.Where(r => r.Id == id && r.EventId == eventId)
|
.Where(r => r.Id == id && r.EventId == eventId)
|
||||||
.Select(r => new RegistrationViewModel
|
.Select(r => new RegistrationViewModel
|
||||||
{
|
{
|
||||||
@@ -102,7 +101,6 @@ public class RegistrationsController : Controller
|
|||||||
public async Task<IActionResult> EditRow(int id, int eventId)
|
public async Task<IActionResult> EditRow(int id, int eventId)
|
||||||
{
|
{
|
||||||
var registration = await ctx.Registrations
|
var registration = await ctx.Registrations
|
||||||
.AsNoTracking()
|
|
||||||
.Where(r => r.Id == id && r.EventId == eventId)
|
.Where(r => r.Id == id && r.EventId == eventId)
|
||||||
.Select(r => new RegistrationViewModel
|
.Select(r => new RegistrationViewModel
|
||||||
{
|
{
|
||||||
@@ -133,7 +131,6 @@ public class RegistrationsController : Controller
|
|||||||
|
|
||||||
var searchTerm = personLookup.Trim().ToLowerInvariant();
|
var searchTerm = personLookup.Trim().ToLowerInvariant();
|
||||||
var query = ctx.People
|
var query = ctx.People
|
||||||
.AsNoTracking()
|
|
||||||
.Where(p =>
|
.Where(p =>
|
||||||
p.FirstNameTranscription.ToLower().Contains(searchTerm) ||
|
p.FirstNameTranscription.ToLower().Contains(searchTerm) ||
|
||||||
p.LastNameTranscription.ToLower().Contains(searchTerm) ||
|
p.LastNameTranscription.ToLower().Contains(searchTerm) ||
|
||||||
@@ -228,7 +225,6 @@ public class RegistrationsController : Controller
|
|||||||
await ctx.SaveChangesAsync();
|
await ctx.SaveChangesAsync();
|
||||||
|
|
||||||
var rowModel = await ctx.Registrations
|
var rowModel = await ctx.Registrations
|
||||||
.AsNoTracking()
|
|
||||||
.Where(r => r.Id == id)
|
.Where(r => r.Id == id)
|
||||||
.Select(r => new RegistrationViewModel
|
.Select(r => new RegistrationViewModel
|
||||||
{
|
{
|
||||||
@@ -283,7 +279,6 @@ public class RegistrationsController : Controller
|
|||||||
var countryFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "CountryCode", "==");
|
var countryFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "CountryCode", "==");
|
||||||
|
|
||||||
var baseQuery = ctx.Registrations
|
var baseQuery = ctx.Registrations
|
||||||
.AsNoTracking()
|
|
||||||
.Where(r => r.EventId == selectedEventId)
|
.Where(r => r.EventId == selectedEventId)
|
||||||
.Select(r => new RegistrationViewModel
|
.Select(r => new RegistrationViewModel
|
||||||
{
|
{
|
||||||
@@ -359,7 +354,6 @@ public class RegistrationsController : Controller
|
|||||||
if (model.PersonId > 0)
|
if (model.PersonId > 0)
|
||||||
{
|
{
|
||||||
model.PersonLookup = await ctx.People
|
model.PersonLookup = await ctx.People
|
||||||
.AsNoTracking()
|
|
||||||
.Where(p => p.Id == model.PersonId)
|
.Where(p => p.Id == model.PersonId)
|
||||||
.Select(p => p.FirstName + " " + p.LastName + " (" + p.FirstNameTranscription + " " + p.LastNameTranscription + ")")
|
.Select(p => p.FirstName + " " + p.LastName + " (" + p.FirstNameTranscription + " " + p.LastNameTranscription + ")")
|
||||||
.FirstOrDefaultAsync() ?? string.Empty;
|
.FirstOrDefaultAsync() ?? string.Empty;
|
||||||
@@ -370,7 +364,6 @@ public class RegistrationsController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
model.SportOptions = await ctx.Sports
|
model.SportOptions = await ctx.Sports
|
||||||
.AsNoTracking()
|
|
||||||
.OrderBy(s => s.Name)
|
.OrderBy(s => s.Name)
|
||||||
.Select(s => new SelectListItem
|
.Select(s => new SelectListItem
|
||||||
{
|
{
|
||||||
@@ -409,7 +402,6 @@ public class RegistrationsController : Controller
|
|||||||
private async Task<List<SelectListItem>> GetCountryOptionsAsync(string? selectedCountryCode)
|
private async Task<List<SelectListItem>> GetCountryOptionsAsync(string? selectedCountryCode)
|
||||||
{
|
{
|
||||||
return await ctx.Countries
|
return await ctx.Countries
|
||||||
.AsNoTracking()
|
|
||||||
.OrderBy(c => c.Name)
|
.OrderBy(c => c.Name)
|
||||||
.Select(c => new SelectListItem
|
.Select(c => new SelectListItem
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -183,7 +183,6 @@ public class SportsController : Controller
|
|||||||
var nameFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "Name");
|
var nameFilter = SieveModelExtensions.ExtractFilterValue(normalizedFilters, "Name");
|
||||||
|
|
||||||
var baseQuery = ctx.Sports
|
var baseQuery = ctx.Sports
|
||||||
.AsNoTracking()
|
|
||||||
.Select(s => new SportViewModel
|
.Select(s => new SportViewModel
|
||||||
{
|
{
|
||||||
Id = s.Id,
|
Id = s.Id,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData[Constants.ViewDataKeys.Title] - Events</title>
|
<title>@ViewData[Constants.ViewDataKeys.Title] - Events</title>
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" asp-append-version="true" />
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-body-tertiary">
|
<body class="bg-body-tertiary">
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/lib/htmx.org/dist/htmx.min.js"></script>
|
<script src="~/lib/htmx.org/dist/htmx.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/pager.js" asp-append-version="true"></script>
|
<script src="~/js/pager.js" asp-append-version="true"></script>
|
||||||
<script>
|
<script>
|
||||||
var toastVariantSuccess = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(Constants.ToastVariants.Success));
|
var toastVariantSuccess = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(Constants.ToastVariants.Success));
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ public class PeopleService : IPeopleService
|
|||||||
public async Task<List<CountryOption>> GetCountryOptionsAsync()
|
public async Task<List<CountryOption>> GetCountryOptionsAsync()
|
||||||
{
|
{
|
||||||
return await ctx.Countries
|
return await ctx.Countries
|
||||||
.AsNoTracking()
|
|
||||||
.OrderBy(d => d.Name)
|
.OrderBy(d => d.Name)
|
||||||
.Select(d => new CountryOption(d.Code, d.Name))
|
.Select(d => new CountryOption(d.Code, d.Name))
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - Events</title>
|
<title>@ViewData["Title"] - Events</title>
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" asp-append-version="true" />
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||||
@RenderSection("Styles", required: false)
|
@RenderSection("Styles", required: false)
|
||||||
</head>
|
</head>
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="~/lib/jquery/jquery.min.js"></script>
|
<script src="~/lib/jquery/jquery.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/pager.js" asp-append-version="true"></script>
|
<script src="~/js/pager.js" asp-append-version="true"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
<script src="~/lib/jquery-validate/jquery.validate.min.js"></script>
|
<script src="~/lib/jquery-validate/jquery.validate.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" asp-append-version="true"></script>
|
||||||
|
|||||||
@@ -232,7 +232,6 @@ public class PeopleController : Controller
|
|||||||
private async Task PrepareDropDownLists(string? selectedCountryCode = null)
|
private async Task PrepareDropDownLists(string? selectedCountryCode = null)
|
||||||
{
|
{
|
||||||
var countries = await ctx.Countries
|
var countries = await ctx.Countries
|
||||||
.AsNoTracking()
|
|
||||||
.OrderBy(d => d.Name)
|
.OrderBy(d => d.Name)
|
||||||
.Select(d => new { d.Name, d.Code })
|
.Select(d => new { d.Name, d.Code })
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label asp-for="CountryCode" class="form-label"></label>
|
<label asp-for="CountryCode" class="form-label"></label>
|
||||||
<select asp-for="CountryCode" asp-items="countries" class="form-select">
|
<select asp-for="CountryCode" asp-items="countries" class="form-select">
|
||||||
<option value="">Select country</option>
|
<option value="" disabled>Select country</option>
|
||||||
</select>
|
</select>
|
||||||
<span asp-validation-for="CountryCode" class="text-danger"></span>
|
<span asp-validation-for="CountryCode" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - Events</title>
|
<title>@ViewData["Title"] - Events</title>
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" asp-append-version="true" />
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||||
@RenderSection("Styles", required: false)
|
@RenderSection("Styles", required: false)
|
||||||
</head>
|
</head>
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="~/lib/jquery/jquery.min.js"></script>
|
<script src="~/lib/jquery/jquery.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
<script src="~/js/pager.js" asp-append-version="true"></script>
|
<script src="~/js/pager.js" asp-append-version="true"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
<script src="~/lib/jquery-validate/jquery.validate.min.js"></script>
|
<script src="~/lib/jquery-validate/jquery.validate.min.js" asp-append-version="true"></script>
|
||||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" asp-append-version="true"></script>
|
||||||
Reference in New Issue
Block a user