public virtual IActionResult Create(ContractFormModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageContractForm)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var item = model.ToEntity <ContractForm>(); //ensure we have "/" at the end _contractFormService.InsertContractForm(item); //activity log _customerActivityService.InsertActivity("AddNewContractForm", string.Format(_localizationService.GetResource("ActivityLog.AddNewContractForm"), item.Id), item); SuccessNotification(_localizationService.GetResource("AppWork.Contracts.ContractForm.Added")); return(continueEditing ? RedirectToAction("Edit", new { id = item.Id }) : RedirectToAction("List")); } //prepare model model = _contractModelFactory.PrepareContractFormModel(model, null); //if we got this far, something failed, redisplay form return(View(model)); }
public virtual IActionResult Edit(ContractFormModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageContractForm)) { return(AccessDeniedView()); } //try to get a store with the specified id var item = _contractFormService.GetContractFormById(model.Id); if (item == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { item = model.ToEntity(item); _contractFormService.UpdateContractForm(item); //activity log _customerActivityService.InsertActivity("EditContractForm", string.Format(_localizationService.GetResource("ActivityLog.EditContractForm"), item.Id), item); SuccessNotification(_localizationService.GetResource("AppWork.Contracts.ContractForm.Updated")); return(continueEditing ? RedirectToAction("Edit", new { id = item.Id }) : RedirectToAction("List")); } //prepare model model = _contractModelFactory.PrepareContractFormModel(model, item, true); //if we got this far, something failed, redisplay form return(View(model)); }