public ActionResult Create(TaskItemViewModel model) { if (!this.ModelState.IsValid) { return View(model); } var taskItem = Mapper.Map<TaskItem>(model); using (this.TaskService) { this.TaskService.Save(taskItem); } return RedirectToAction("Index"); }
public ActionResult Edit(TaskItemViewModel model) { if (!this.ModelState.IsValid) { return View(model); } using (this.TaskService) { var efModel = this.TaskService.Get(model.Id); Mapper.Map<TaskItemViewModel, TaskItem>(model, efModel); this.TaskService.Save(efModel); } return RedirectToAction("Index"); }