public override ActionResult Edit(TEditableModel editableModel, bool continueEditing) { if (!IsUserizedRequest) { return(AccessDeniedView()); } if (!ModelState.IsValid) { InjectModelDependencies(editableModel); return(View(editableModel)); } var entity = GetEntityById(editableModel.Id)(); if (entity == null) { return(HandleUnknown(editableModel.Id)); } entity = editableModel.ToEntity(entity); var operationResult = UpdateEntityAndReturnOperationResult(entity)(); if (!operationResult.Success) { ModelState.InjectMessages(operationResult); ResourceErrorNotification(CommonConstants.Systematic.NotUpdated); InjectModelDependencies(editableModel); return(View(editableModel)); } ResourceSuccessNotification(CommonConstants.Systematic.Updated); if (continueEditing) { return(RedirectToAction(KnownActionNames.Edit, RouteParameter.Add(KnownParameterNames.Id, entity.Id))); } return(RedirectToAction(KnownActionNames.List, RouteParameter.Add(KnownParameterNames.Page, 1))); }
public override ActionResult Edit(long id) { if (!IsUserizedRequest) { return(AccessDeniedView()); } var entity = GetEntityById(id)(); if (entity == null) { return(HandleUnknown(id)); } var editableModel = entity.ToEditableModel <TEntity, TEditableModel>(); InjectModelDependencies(editableModel); return(View(editableModel)); }