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), ConcurrencyCheck = entityRecord.GetConcurrencyCheckValue() }; return View(model); }
public ActionResult Edit( string entityName, string key, [Bind(Prefix = "__ConcurrencyCheck")] string concurrencyCheck, FormCollection collection) { var entity = _admin.GetEntity(entityName); if (entity == null) { return RedirectToAction("NotFound", new { entityName }); } var concurrencyCheckValue = ConcurrencyCheck.Convert(concurrencyCheck, entity); var isSuccess = _entityService.Edit(entity, key, collection, Request.Files, concurrencyCheckValue); if (isSuccess) { _notificator.Success(IlaroAdminResources.EditSuccess, entity.Verbose.Singular); return SaveOrUpdateSucceed(entityName, key); } var entityRecord = entity.CreateRecord(key, collection, Request.Files); var model = new EntityEditModel { Entity = entity, Record = entityRecord, PropertiesGroups = _entityService.PrepareGroups(entityRecord, getKey: false, key: key), ConcurrencyCheck = concurrencyCheckValue }; return View(model); }