public ActionResult Create(string entityName, FormCollection collection) { var entity = Admin.GetEntity(entityName); if (entity == null) { return(RedirectToAction("NotFound", new { entityName })); } try { var savedId = _entityService.Create(entity, collection, Request.Files); if (savedId != null) { _notificator.Success(IlaroAdminResources.AddSuccess, entity.Verbose.Singular); return(SaveOrUpdateSucceed(entityName, savedId)); } } catch (Exception ex) { _log.Error(ex); _notificator.Error(ex.Message); } var model = new EntityCreateOrEditModel { Entity = entity, PropertiesGroups = _entityService.PrepareGroups(entity) }; return(View(model)); }
public virtual ActionResult Create(string entityName) { var entity = Admin.GetEntity(entityName); if (entity == null) { return(RedirectToAction("NotFound", new { entityName })); } var model = new EntityCreateOrEditModel { Entity = entity, PropertiesGroups = _entityService.PrepareGroups(entity) }; return(View(model)); }
public virtual ActionResult Edit(string entityName, string key) { var entity = Admin.GetEntity(entityName); if (entity == null) { return(RedirectToAction("NotFound", new { entityName })); } entity = _source.GetEntityWithData(entity, key); if (entity == null) { return(RedirectToAction("Index", "Entities", new { area = "IlaroAdmin", entityName })); } var model = new EntityCreateOrEditModel { Entity = entity, PropertiesGroups = _entityService.PrepareGroups(entity, false, key) }; return(View(model)); }