示例#1
0
        public IActionResult Edit(CustomerActionModel model, bool continueEditing)
        {
            CheckValidateModel(model);

            var customeraction = _customerActionService.GetCustomerActionById(model.Id);

            if (customeraction == null)
            {
                return(RedirectToAction("List"));
            }
            try
            {
                if (ModelState.IsValid)
                {
                    customeraction = _customerActionViewModelService.UpdateCustomerActionModel(customeraction, model);
                    SuccessNotification(_localizationService.GetResource("Admin.Customers.CustomerAction.Updated"));
                    return(continueEditing ? RedirectToAction("Edit", new { id = customeraction.Id }) : RedirectToAction("List"));
                }
                _customerActionViewModelService.PrepareReactObjectModel(model);
                return(View(model));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("Edit", new { id = customeraction.Id }));
            }
        }