예제 #1
0
        public ActionResult Create(TEditModel model)
        {
            var entity = new TEntity();

            EditEntityModelMapper.MergeEntityWithModel(entity, model);

            Repository.Add(entity);

            return(RedirectToAction("Details", new { id = entity.Id }));
        }
예제 #2
0
        public ActionResult Edit(int id)
        {
            var item = Repository.GetItem(id);

            if (item == null)
            {
                return(PageNotFound());
            }

            var model = EditEntityModelMapper.ModelFromEntity(item);

            return(View(model));
        }
예제 #3
0
 private ActionResult SaveExistingEntity(TEditModel model, TEntity existingEntity)
 {
     EditEntityModelMapper.MergeEntityWithModel(existingEntity, model);
     Repository.NotifyItemWasChanged(existingEntity);
     return(RedirectToAction("Details", new { id = existingEntity.Id }));
 }
예제 #4
0
        public ActionResult Create()
        {
            var model = EditEntityModelMapper.ModelFromEntity(new TEntity());

            return(View("Edit", model));
        }