public ActionResult Create(HairStyleViewModel hairStyle) { try { if (ModelState.IsValid) { _hairStyleRepository.Insert(hairStyle.GetOriginalSource()); return RedirectToAction("Index"); } return View(); } catch (Exception ex) { return View(); } }
public ActionResult Edit(int id, HairStyleViewModel hairStyle) { try { if (ModelState.IsValid) { var source = hairStyle.GetOriginalSource(); source.id = id; _hairStyleRepository.Update(source); return RedirectToAction("Index"); } return View(); } catch (Exception ex) { return View(); } }