public ViewResult CreateToDoList() { var usersContext = new ApplicationDbContext(); var toDoList = this.session.Repository<ToDoList>().Create(); var toDoListViewModel = new ToDoListViewModel() { Performers = usersContext.Users.Select(u => new Performer() { Id = u.Id, Name = u.UserName }).ToList(), SelectedPerformerId = string.Empty, ToDoList = toDoList }; return View("EditToDoList", toDoListViewModel); }
public ActionResult EditToDoList(ToDoListViewModel viewModel) { if (!ModelState.IsValid) return View(viewModel); this.SaveEntity(viewModel.ToDoList); return RedirectToAction("Index"); }