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")); }
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)); }
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")); }