public ActionResult Create(CategoryInputModel categoryInputModel) { var category = Mapper.Map<CategoryInputModel, Category>(categoryInputModel); category.Created = System.DateTime.Now; _repository.Create(category); return RedirectToAction("Index"); }
public ActionResult Edit(CategoryInputModel model, int id) { if (ModelState.IsValid) { var category = _repository.GetById<Category>(id); var tmpDate = category.Created; category = Mapper.Map<CategoryInputModel, Category>(model); category.Created = tmpDate; _repository.Update(category); Success("The model was updated!"); return RedirectToAction("index"); } return View("Create", model); }