public async Task <IActionResult> EditDivision(int id) { DivisionWithSupervisor div = await _webApiCalls.GetDivisionAsync(id); ViewBag.Supervisors = await _webApiCalls.GetSupervisorsForDropDown(); return(View(div)); }
public async Task <IActionResult> AddDivision() { DivisionWithSupervisor division = new DivisionWithSupervisor(); ViewBag.Supervisors = await _webApiCalls.GetSupervisorsForDropDown(); return(View(division)); }
public async Task <IActionResult> AddDivision(DivisionWithSupervisor division) { if (!ModelState.IsValid) { return(View(division)); } var dv = new Division() { DivisionName = division.DivisionName, SupervisorId = division.SupervisorId, }; var result = await _webApiCalls.CreateAsync(dv); return(RedirectToAction("Index")); }
public async Task <IActionResult> EditDivision(int id, DivisionWithSupervisor div) { if (!ModelState.IsValid) { return(View(div)); } var division = new Division() { Id = div.Id, Active = div.Active, DivisionName = div.DivisionName, SupervisorId = div.SupervisorId, TimeStamp = div.TimeStamp }; var result = await _webApiCalls.UpdateAsync(div.Id, division); return(RedirectToAction("Index")); }