public ActionResult Edit(EditRecommendationViewModel vm) { if (ModelState.IsValid) { Recommendation rec = Mapper.From(vm); rec = recRepo.Update(rec); return(RedirectToAction("list")); } return(View(vm)); }
public ActionResult Edit(int id) { Recommendation rec = recRepo.Get(id); if (rec == null) { return(RedirectToAction("notfound", "error")); } EditRecommendationViewModel vm = Mapper.ToEditRecommendationViewModel(rec); return(View(vm)); }