public ActionResult Edit(string entityName, string key, FormCollection collection) { var entity = _admin.GetEntity(entityName); if (entity == null) { return RedirectToAction("NotFound", new { entityName }); } try { var isSuccess = _entityService.Edit(entity, key, collection, Request.Files); if (isSuccess) { _notificator.Success(IlaroAdminResources.EditSuccess, entity.Verbose.Singular); return SaveOrUpdateSucceed(entityName, key); } } catch (Exception ex) { _log.Error(ex); _notificator.Error(ex.Message); } var entityRecord = new EntityRecord(entity); entityRecord.Fill(key, collection, Request.Files); var model = new EntityEditModel { Entity = entity, Record = entityRecord, PropertiesGroups = _entityService.PrepareGroups(entityRecord, getKey: false, key: key) }; return View(model); }
public ActionResult Edit( string entityName, string key, FormCollection collection) { var entity = AdminInitialise.EntitiesTypes .FirstOrDefault(x => x.Name == entityName); if (entity == null) { throw new NoNullAllowedException("entity is null"); } entity.Fill(collection, Request.Files); if (_validator.Validate(entity)) { try { var result = _entityService.Edit(entity); if (result) { _notificator.Success(IlaroAdminResources.EditSuccess, entity.Verbose.Singular); if (Request["ContinueEdit"] != null) { return RedirectToAction("Edit", new { entityName, key }); } if (Request["AddNext"] != null) { return RedirectToAction("Create", new { entityName }); } return RedirectToAction("Index", "Entities", new { entityName }); } _notificator.Error(IlaroAdminResources.UncaughtError); } catch (Exception ex) { var message = ex.Message; if (ex.InnerException != null) { message += "<br />" + ex.InnerException.Message; } _notificator.Error(message); } } var model = new EntityEditModel { Entity = entity, PropertiesGroups = _entityService.PrepareGroups(entity, false, key) }; return View(model); }
public virtual ActionResult Edit(string entityName, string key) { var entity = _admin.GetEntity(entityName); if (entity == null) { return RedirectToAction("NotFound", new { entityName }); } var entityRecord = _source.GetEntityRecord(entity, key); if (entityRecord == null) { return RedirectToAction("Index", "Entities", new { area = "IlaroAdmin", entityName }); } var model = new EntityEditModel { Entity = entity, Record = entityRecord, PropertiesGroups = _entityService.PrepareGroups(entityRecord, getKey: false, key: key) }; return View(model); }
public virtual ActionResult Edit(string entityName, string key) { var entity = _source.GetEntityWithData(entityName, key); if (entity == null) { return RedirectToAction("Index", "Entities", new { entityName }); } var model = new EntityEditModel { Entity = entity, PropertiesGroups = _entityService.PrepareGroups(entity, false, key) }; return View(model); }