Skip to content

Commit

Permalink
Updated Error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic NEED authored and Dominic NEED committed Jan 5, 2024
1 parent 029171e commit e593477
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ public override async Task<IActionResult> OnPostAsync(int id)
await base.OnGetAsync(id);
if (NumberOfFundedResidentialPlaces is null)
{
ModelState.AddModelError(nameof(NumberOfFundedResidentialPlaces), "You must enter the number of places funded for");
_errorService.AddError(nameof(NumberOfFundedResidentialPlaces), "Enter a number. No letters or special characters.");
}


if (ModelState.IsValid)
{
SetSchoolOverviewModel updatedSchoolOverview = CreateUpdateSchoolOverview(Project);
Expand All @@ -48,7 +47,6 @@ public override async Task<IActionResult> OnPostAsync(int id)
return RedirectToPage(Links.SchoolOverviewSection.ConfirmSchoolOverview.Page, new { id });
}

_errorService.AddErrors(ModelState.Keys, ModelState);
return await base.OnGetAsync(id);
}
public static SetSchoolOverviewModel CreateUpdateSchoolOverview(ProjectViewModel projectViewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override async Task<IActionResult> OnPostAsync(int id)
await base.OnGetAsync(id);
if (NumberOfPlacesFundedFor is null)
{
ModelState.AddModelError(nameof(NumberOfPlacesFundedFor), "You must enter the number of places funded for");
_errorService.AddError(nameof(NumberOfPlacesFundedFor), "Enter a number. No letters or special characters.");
}


Expand All @@ -48,7 +48,7 @@ public override async Task<IActionResult> OnPostAsync(int id)
return RedirectToPage(Links.SchoolOverviewSection.ConfirmSchoolOverview.Page, new { id });
}

_errorService.AddErrors(ModelState.Keys, ModelState);

return await base.OnGetAsync(id);
}
public static SetSchoolOverviewModel CreateUpdateSchoolOverview(ProjectViewModel projectViewModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public override async Task<IActionResult> OnPostAsync(int id)
await base.OnGetAsync(id);
if (NumberOfResidentialPlaces is null)
{
ModelState.AddModelError(nameof(NumberOfResidentialPlaces), "You must enter the number of places funded for");
_errorService.AddError(nameof(NumberOfResidentialPlaces), "Enter a number. No letters or special characters.");
}


Expand All @@ -48,7 +48,6 @@ public override async Task<IActionResult> OnPostAsync(int id)
return RedirectToPage(Links.SchoolOverviewSection.ConfirmSchoolOverview.Page, new { id });
}

_errorService.AddErrors(ModelState.Keys, ModelState);
return await base.OnGetAsync(id);
}
public static SetSchoolOverviewModel CreateUpdateSchoolOverview(ProjectViewModel projectViewModel)
Expand Down

0 comments on commit e593477

Please sign in to comment.