public async Task <IActionResult> EditDepartment(int id) { DepartmentWithDivision dp = await _webApiCalls.GetDepartmentAsync(id); ViewBag.Divisions = await _webApiCalls.GetDivisionsForDropDown(); return(View(dp)); }
public async Task <IActionResult> AddDepartment() { DepartmentWithDivision dp = new DepartmentWithDivision(); ViewBag.Divisions = await _webApiCalls.GetDivisionsForDropDown(); return(View(dp)); }
public async Task <IActionResult> AddDepartment(DepartmentWithDivision dept) { if (!ModelState.IsValid) { return(View(dept)); } var dp = new Department() { DepartmentName = dept.DepartmentName, DivisionId = dept.DivisionId }; var result = await _webApiCalls.CreateAsync(dp); return(RedirectToAction("Index")); }
public async Task <IActionResult> EditDepartment(DepartmentWithDivision dept) { if (!ModelState.IsValid) { return(View(dept)); } var dp = new Department() { Id = dept.Id, Active = dept.Active, DepartmentName = dept.DepartmentName, DivisionId = dept.DivisionId, TimeStamp = dept.TimeStamp }; var result = await _webApiCalls.UpdateAsync(dept.Id, dp); return(RedirectToAction("Index")); }