Exemplo n.º 1
0
        public ActionResult EditScheduler(int id)
        {
            var dto = SchedulerRepository.GetScheduler(id);

            if (dto != null)
            {
                var vm = SchedulerViewModel.Create(dto);
                return(View(vm));
            }
            return(RedirectToAction("scheduler-manager"));
        }
Exemplo n.º 2
0
        public ActionResult SchedulerManager()
        {
            var dtos = SchedulerRepository.GetSchedulers();
            var vms  = new List <SchedulerViewModel>();

            foreach (var dto in dtos)
            {
                vms.Add(SchedulerViewModel.Create(dto));
            }
            return(View(vms));
        }
Exemplo n.º 3
0
        public ActionResult CreateScheduler(SchedulerViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var dto = model.ToDto();
            var vm  = SchedulerViewModel.Create(dto);

            SchedulerRepository.Create(model.ToDto());
            return(RedirectToAction("scheduler-manager"));
        }