Ejemplo n.º 1
0
        public ActionResult Index(AddShiftView shift)
        {
            Shift s = new Shift();

            s.Capacity = shift.Capacity;
            s.Vacancy  = s.Capacity;
            s.JobId    = shift.JobId;
            s.RoleId   = shift.RoleId;
            s.Start    = shift.Start;
            s.End      = shift.End;
            if (ModelState.IsValid)
            {
                Repository.CreateShift(s);
            }
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 2
0
        public ActionResult CreateShift()
        {
            IRepository repo      = new Repository();
            var         jobs      = repo.JobList();
            var         roles     = repo.RoleList();
            var         viewModel = new AddShiftView();

            viewModel.JobsList = jobs.Select(x => new SelectListItem
            {
                Value = x.Id.ToString(),
                Text  = x.Name
            });
            viewModel.RolesList = roles.Select(x => new SelectListItem
            {
                Value = x.Id.ToString(),
                Text  = x.Name
            });
            return(View(viewModel));
        }