public ActionResult AssignNewSupervisor() { var EmpID = Request.Form["EmployeeID"]; var Hrcsupervisor = Request.Form["HrcSupervisor"]; var Supervisor = Request.Form["Supervisor"]; var PageNum = Request.Form["PageNum"]; var Urlback = Request.Form["UrlBack"]; if (Supervisor == "X") { Supervisor = ""; } var EmpDcr = ldcr.EmployeeDCRs.Where(emp => emp.BadgeNo == EmpID).FirstOrDefault(); if (EmpDcr == null) { EmployeeDCR dcr = new EmployeeDCR { BadgeNo = EmpID, HRCSupervisor = Hrcsupervisor, CurrentSupervisor = Supervisor }; ldcr.EmployeeDCRs.Add(dcr); ldcr.SaveChanges(); } else { EmpDcr.CurrentSupervisor = Supervisor; ldcr.Entry(EmpDcr).State = EntityState.Modified; ldcr.SaveChanges(); } return(RedirectToAction(Urlback, "IT", new { page = PageNum })); }
public ActionResult AssignNewCell() { var EmpID = Request.Form["EmployeeID"]; var Hrccell = Request.Form["HrcCell"]; var Cell = Request.Form["Cell"]; var PageNum = Request.Form["PageNum"]; var Urlback = Request.Form["UrlBack"]; if (Cell == "X") { Cell = ""; } var EmpDcr = ldcr.EmployeeDCRs.Where(emp => emp.BadgeNo == EmpID).FirstOrDefault(); if (EmpDcr == null) { EmployeeDCR dcr = new EmployeeDCR { BadgeNo = EmpID, HRCCell = Hrccell, CurrentCell = Cell }; ldcr.EmployeeDCRs.Add(dcr); ldcr.SaveChanges(); } else { EmpDcr.CurrentCell = Cell; ldcr.Entry(EmpDcr).State = EntityState.Modified; ldcr.SaveChanges(); } return(RedirectToAction(Urlback, "IT", new { page = PageNum })); }