public ActionResult Edit(CategoryModel model) { try { var entity = model.ToEntity<CategoryModel, Category>(); entity.LastModifiedDate = DateTime.Now; Handler.Update(entity); } catch (Exception ex) { model.Error = ex.Message; return View("Edit", model); } return RedirectToAction("Index"); }
public ActionResult Add(CategoryModel model) { try { var entity = model.ToEntity<CategoryModel, Category>(); entity.CreationDate = DateTime.Now; Handler.Add(entity); } catch (Exception ex) { model.Error = ex.Message; return View("Add", model); } return RedirectToAction("Index"); }