public ActionResult DeleteDepartment(int id) { var department = _departmentManager.GetById(id); department.IsActive = !department.IsActive; _departmentManager.Update(department); return(RedirectToAction("Index")); }
// GET: Department/Details/5 public ActionResult Details(int?id) { if (id == null) { return(NotFound()); } var department = _iDepartmentManager.GetById(id); if (department == null) { return(NotFound()); } return(View()); }
// GET: Departments/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Department department = _departmentManager.GetById((int)id); if (department == null) { return(HttpNotFound()); } DepartmentViewModel departmentViewModel = Mapper.Map <DepartmentViewModel>(department); return(View(departmentViewModel)); }
// GET: /Department/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Department department = _departmentManager.GetById((int)id); if (department == null) { return(HttpNotFound()); } var organizationBranchList = _organizationBranchManager.GetAll(); ViewBag.OrganizationBranchID = new SelectList(organizationBranchList, "OrganizationBranchID", "OrganizationBranchName"); return(View(department)); }
// GET: Department/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var organaization = _organaizationManager.GetAll(); Department department = _departmentManager.GetById((int)id); DepartmentViewModel departmentVM = new DepartmentViewModel() { Name = department.Name, Organaization = organaization.Where(x => x.Id == department.OrganaizationId).FirstOrDefault() }; return(View(departmentVM)); }
public async Task <IActionResult> GetDepartmentByIdAsync([FromRoute] string id) { if (string.IsNullOrWhiteSpace(id)) { return(BadRequest("Id is null or invalid")); } var department = await _departmentManager.GetById(id); if (department == null) { return(BadRequest("Department not found")); } var response = _mapper.Map <DepartmentResponse>(department); return(Ok(response)); }
public ActionResult Update(int id) { return(View(_departmentManager.GetById(id))); }
public ActionResult Edit(int id) { Department aDepartment = _iDepartmentManager.GetById(id); return(View(aDepartment)); }