Esempio n. 1
0
        public ActionResult Accept(int id)
        {
            SwitchShift switchShift = db.SwitchShifts.Find(id);

            switchShift.EmployeeAccepted = true;
            db.SaveChanges();
            return(RedirectToAction("Index", "Home"));
        }
Esempio n. 2
0
        // 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));
        }
Esempio n. 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            SwitchShift switchShift = db.SwitchShifts.Find(id);

            db.SwitchShifts.Remove(switchShift);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 4
0
        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"));
        }
Esempio n. 5
0
 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));
 }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        // 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));
        }
Esempio n. 8
0
        // 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));
        }