public ActionResult Accept(int id) { SwitchShift switchShift = db.SwitchShifts.Find(id); switchShift.EmployeeAccepted = true; db.SaveChanges(); return(RedirectToAction("Index", "Home")); }
// GET: SwitchShifts/Create public ActionResult Create(int id) { ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "FullName"); var shift = new SwitchShift(); shift.ShiftId = db.Shifts.Where(data => data.Id == id).Select(data => data.Id).First(); return(View(shift)); }
public ActionResult DeleteConfirmed(int id) { SwitchShift switchShift = db.SwitchShifts.Find(id); db.SwitchShifts.Remove(switchShift); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ManagerAccept(int id) { SwitchShift switchShift = db.SwitchShifts.Find(id); switchShift.ManagerAccepted = true; db.SaveChanges(); Shift shift = db.Shifts.Find(switchShift.ShiftId); shift.EmployeeId = switchShift.EmployeeId; db.SaveChanges(); return(RedirectToAction("Index", "Home")); }
public ActionResult Edit([Bind(Include = "Id,ShiftId,EmployeeId,EmployeeAccepted,ManagerAccepted")] SwitchShift switchShift) { if (ModelState.IsValid) { db.Entry(switchShift).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "UserId", switchShift.EmployeeId); ViewBag.ShiftId = new SelectList(db.Shifts, "Id", "Id", switchShift.ShiftId); return(View(switchShift)); }
public ActionResult Create([Bind(Include = "Id,ShiftId,EmployeeId,EmployeeAccepted,ManagerAccepted")] SwitchShift switchShift) { if (ModelState.IsValid) { switchShift.ShiftId = 2; db.SwitchShifts.Add(switchShift); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "UserId", switchShift.EmployeeId); ViewBag.ShiftId = new SelectList(db.Shifts, "Id", "Id", switchShift.ShiftId); return(View(switchShift)); }
// GET: SwitchShifts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SwitchShift switchShift = db.SwitchShifts.Find(id); if (switchShift == null) { return(HttpNotFound()); } return(View(switchShift)); }
// GET: SwitchShifts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SwitchShift switchShift = db.SwitchShifts.Find(id); if (switchShift == null) { return(HttpNotFound()); } ViewBag.EmployeeId = new SelectList(db.Employees, "Id", "UserId", switchShift.EmployeeId); ViewBag.ShiftId = new SelectList(db.Shifts, "Id", "Id", switchShift.ShiftId); return(View(switchShift)); }