Ejemplo n.º 1
0
        public ActionResult EditNurseSchedule(int id)
        {
            var collection = new NurseScheduleCollection
            {
                NurseSchedule = db.NurseSchedules.Single(c => c.Id == id),
                Nurses        = db.Nurses.ToList()
            };

            return(View(collection));
        }
Ejemplo n.º 2
0
        public ActionResult AddNurseSchedule()
        {
            var collection = new NurseScheduleCollection
            {
                NurseSchedule = new NurseSchedule(),
                Nurses        = db.Nurses.ToList()
            };

            return(View(collection));
        }
Ejemplo n.º 3
0
        public ActionResult AddNurseSchedule(NurseScheduleCollection model)
        {
            if (!ModelState.IsValid)
            {
                var collection = new NurseScheduleCollection
                {
                    NurseSchedule = model.NurseSchedule,
                    Nurses        = db.Nurses.ToList()
                };
                return(View(collection));
            }

            db.NurseSchedules.Add(model.NurseSchedule);
            db.SaveChanges();
            return(RedirectToAction("ListOfNurseSchedules"));
        }
Ejemplo n.º 4
0
        public ActionResult EditNurseSchedule(int id, NurseScheduleCollection model)
        {
            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var NurseSchedule = db.NurseSchedules.Single(c => c.Id == id);

            NurseSchedule.NurseId            = model.NurseSchedule.NurseId;
            NurseSchedule.AvailableEndDay    = model.NurseSchedule.AvailableEndDay;
            NurseSchedule.AvailableEndTime   = model.NurseSchedule.AvailableEndTime;
            NurseSchedule.AvailableStartDay  = model.NurseSchedule.AvailableStartDay;
            NurseSchedule.AvailableStartTime = model.NurseSchedule.AvailableStartTime;
            NurseSchedule.Status             = model.NurseSchedule.Status;

            db.SaveChanges();
            return(RedirectToAction("ListOfNurseSchedules"));
        }