public virtual IActionResult Create(ProcuringAgencyModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageProcuringAgency)) { return(AccessDeniedView()); } if (ModelState.IsValid) { var item = model.ToEntity <ProcuringAgency>(); //ensure we have "/" at the end _procuringAgencyService.InsertProcuringAgency(item); //activity log _customerActivityService.InsertActivity("AddNewProcuringAgency", string.Format(_localizationService.GetResource("ActivityLog.AddNewProcuringAgency"), item.Id), item); SuccessNotification(_localizationService.GetResource("AppWork.Contracts.ProcuringAgency.Added")); return(continueEditing ? RedirectToAction("Edit", new { id = item.Id }) : RedirectToAction("List")); } //prepare model model = _procuringAgencyModelFactory.PrepareProcuringAgencyModel(model, null); //if we got this far, something failed, redisplay form return(View(model)); }
public virtual IActionResult _Create(ProcuringAgencyModel model, bool continueEditing) { if (ModelState.IsValid) { var item = model.ToEntity <ProcuringAgency>(); //ensure we have "/" at the end _procuringAgencyService.InsertProcuringAgency(item); //activity log _customerActivityService.InsertActivity("AddNewProcuringAgency", string.Format(_localizationService.GetResource("ActivityLog.AddNewProcuringAgency"), item.Id), item); return(JsonSuccessMessage("ok", item)); } //if we got this far, something failed, redisplay form return(JsonErrorMessage()); }
public virtual IActionResult Edit(ProcuringAgencyModel model, bool continueEditing) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageProcuringAgency)) { return(AccessDeniedView()); } //try to get a store with the specified id var item = _procuringAgencyService.GetProcuringAgencyById(model.Id); if (item == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { item = model.ToEntity(item); _procuringAgencyService.UpdateProcuringAgency(item); //activity log _customerActivityService.InsertActivity("EditProcuringAgency", string.Format(_localizationService.GetResource("ActivityLog.EditProcuringAgency"), item.Id), item); SuccessNotification(_localizationService.GetResource("AppWork.Contracts.ProcuringAgency.Updated")); return(continueEditing ? RedirectToAction("Edit", new { id = item.Id }) : RedirectToAction("List")); } //prepare model model = _procuringAgencyModelFactory.PrepareProcuringAgencyModel(model, item, true); //if we got this far, something failed, redisplay form return(View(model)); }