public async Task <IActionResult> EditStudent(StudentModifyInputModel inputModel) { if (!ModelState.IsValid || inputModel.Student.SchoolId.IsNullOrEmpty() || inputModel.Student.ClassId.IsNullOrEmpty()) { //ToDo: in case of null school/class, return appropriate message or add model validation? return(View(inputModel)); } try { await _studentsService.EditAsync(inputModel); return(RedirectToAction(nameof(Index))); } catch (Exception e) { _logger.LogError(e, $"An exception occured during student UPDATE operation for student with id {inputModel.Id}. Ex: {e.Message}"); return(RedirectToAction("Error", "Home")); } }