예제 #1
0
        public IActionResult Delete(string id)
        {
            var isCanDelResult = _departmentService.IsCanDelete(id);

            if (!isCanDelResult.Success)
            {
                return(Json(isCanDelResult));
            }

            var delResult = _departmentService.DeleteById(id);

            return(Json(delResult));
        }
        protected void RepeaterDepartment_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var DepartmentID = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Edit")
            {
                Response.Redirect("EditDepartment.aspx?id=" + DepartmentID);
            }
            if (e.CommandName == "Delete")
            {
                DepartmentService departmentService = new DepartmentService();
                departmentService.DeleteById(DepartmentID);
                Response.Redirect("DepartmentList.aspx");
            }
            if (e.CommandName == "Details")
            {
                Response.Redirect("DetailDepartment.aspx?id=" + DepartmentID);
            }
        }
예제 #3
0
 public ActionResult Delete(int id)
 {
     departmentService.DeleteById(id);
     return(RedirectToAction("Index"));
 }