public async Task<IActionResult> DeleteTeacherAsync(int teacherId) { var command = new DeleteTeacherCommand { Id = teacherId }; await mediator.Send(command); return NoContent(); }
protected void prof_ItemCommand(object source, RepeaterCommandEventArgs e) { ImageButton action = (ImageButton)e.CommandSource; string actionString = action.ID; if (action.ID.Equals("delete")) { try { string email = ((Label)prof_data.Items[e.Item.ItemIndex].FindControl("Email")).Text; teacher = new Teacher(); teacher.Email = email; DeleteTeacherCommand cmd = new DeleteTeacherCommand(teacher); cmd.Execute(); if (teacher.Code == 200) { ClientScript.RegisterClientScriptBlock(this.GetType(), "random", "alertme()", true); } else { } } catch (Exception ex) { } } else if (action.ID.Equals("modify")) { try { string email = ((Label)prof_data.Items[e.Item.ItemIndex].FindControl("Email")).Text; Session["Email_prof"] = email; Response.Redirect("/site/admin/adm_professor/edit_prof.aspx"); } catch (Exception ex) { } } }