public ActionResult Create(TEditModel model) { var entity = new TEntity(); EditEntityModelMapper.MergeEntityWithModel(entity, model); Repository.Add(entity); return(RedirectToAction("Details", new { id = entity.Id })); }
public ActionResult Edit(int id) { var item = Repository.GetItem(id); if (item == null) { return(PageNotFound()); } var model = EditEntityModelMapper.ModelFromEntity(item); return(View(model)); }
private ActionResult SaveExistingEntity(TEditModel model, TEntity existingEntity) { EditEntityModelMapper.MergeEntityWithModel(existingEntity, model); Repository.NotifyItemWasChanged(existingEntity); return(RedirectToAction("Details", new { id = existingEntity.Id })); }
public ActionResult Create() { var model = EditEntityModelMapper.ModelFromEntity(new TEntity()); return(View("Edit", model)); }