public async Task <IActionResult> DeleteTeacher(TeacherModifyInputModel inputModel, string onSubmitAction) { if (onSubmitAction.IsNullOrEmpty() || onSubmitAction == "Cancel") { return(RedirectToAction(nameof(Index))); } if (!inputModel.Teacher.SchoolId.IsNullOrEmpty()) { return(View(inputModel)); } try { await _teachersService.DeleteAsync(inputModel.Id); return(RedirectToAction(nameof(Index))); } catch (Exception e) { _logger.LogError(e, $"An exception occured during teacher DELETE operation for teacher with id {inputModel.Id}. Ex: {e.Message}"); return(RedirectToAction("Error", "Home")); } }