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