public async Task <IActionResult> OnPostAsync() { if (ModelState.IsValid) { if (await _patternService.UpdatePatternAsync(Pattern) != null) { TempData["Success"] = "Pattern successfully updated."; return(RedirectToPage("Index")); } else { ViewData["Message"] = "Database error,Contact the developer to fix the error."; _logger.LogError($"Pattern {nameof(EditModel)} database error! "); return(Page()); } } ViewData["Message"] = "Your input is not valid"; _logger.LogError($"Pattern {nameof(EditModel)} database error! "); return(Page()); }
public async Task <IActionResult> OnPostAsync() { if (ModelState.IsValid) { if (await _patternServicee.UpdatePatternAsync(Pattern) != null) { // success TempData["Success"] = "Pattern Successfully edited."; return(RedirectToPage("Index")); } else { // db failure ViewData["Message"] = "Database error, contact the developer to fix the error."; _logger.LogError($"EyeColor {nameof(EditModel)} database error."); return(Page()); } } // invalid inputs by admin ViewData["Message"] = "your inputs is not valid."; _logger.LogError($"EyeColor {nameof(EditModel)} invalid inputs."); return(Page()); }