public virtual async Task <ActionResult> Edit(dynamic id, FormCollection formCollection, string submitType, string returnUrl) { id = ParseKeyType(id); var model = _dynamicRepository.GetItem(EntityType, KeyName, id, DynamicEntityMetadata.InstanceIncludes().ToArray()); var viewModel = DynamicEditViewModelBuilder.Build(DynamicEntityMetadata, model, returnUrl); if (await TryUpdateModelAsync <DynamicCreateViewModel>(viewModel.Item, "Item")) { var dynamicOperation = DynamicEntityMetadata.GetDynamicOperation(TemplateTypeEnum.Edit, submitType); dynamicOperation.PerformPreSaveOperation(id, formCollection, model, ref returnUrl, TempData, ViewData); if (dynamicOperation.PersistModel) { EditItem(model); } dynamicOperation.PeformPostSaveOperation(id, formCollection, model, ref returnUrl, TempData, ViewData); if (dynamicOperation.ReturnSucessfulRedirect) { return(ReturnSuccessfulRedirect(returnUrl, model)); } } return(View("DynamicEdit", viewModel)); }
public virtual ActionResult Edit(dynamic id, string returnUrl) { id = ParseKeyType(id); var model = _dynamicRepository.GetItem(EntityType, KeyName, id, DynamicEntityMetadata.InstanceIncludes().ToArray()); var viewModel = DynamicEditViewModelBuilder.Build(DynamicEntityMetadata, model, returnUrl); return(View("DynamicEdit", viewModel)); }