public ActionResult Update(CustomerItemModel customerItemModel)
        {
            try
            {
                if (IsUpdate(customerItemModel.OperationResult))
                {
                    if (IsValid(customerItemModel.OperationResult, customerItemModel.Customer))
                    {
                        Customer customer = (Customer)customerItemModel.Customer.ToData();
                        if (Application.Update(customerItemModel.OperationResult, customer))
                        {
                            if (customerItemModel.IsSave)
                            {
                                return(JsonResultSuccess(customerItemModel.OperationResult,
                                                         Url.Action("Update", "Customer", new { CustomerId = customer.CustomerId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(customerItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            customerItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(customerItemModel.OperationResult));
        }
Пример #2
0
        public ActionResult Delete(CustomerItemModel customerItemModel)
        {
            try
            {
                if (Application.Delete(customerItemModel.OperationResult, (CustomerDTO)customerItemModel.Customer.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(customerItemModel.OperationResult));
        }
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            CustomerItemModel customerItemModel = new CustomerItemModel(ActivityOperations, "Create", masterEntity, masterKey);

            try
            {
                if (IsCreate(customerItemModel.OperationResult))
                {
                    return(ZPartialView("CRUD", customerItemModel));
                }
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(customerItemModel.OperationResult));
        }
Пример #4
0
        public ActionResult Create(CustomerItemModel customerItemModel)
        {
            try
            {
                if (ValidateModelState(Application.Repository))
                {
                    if (Application.Create(customerItemModel.OperationResult, (CustomerDTO)customerItemModel.Customer.ToDTO()))
                    {
                        return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                    }
                }
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(customerItemModel.OperationResult));
        }
Пример #5
0
        public ActionResult Create()
        {
            CustomerItemModel customerItemModel = new CustomerItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Customer             = new CustomerViewModel(),
                ControllerAction     = "Create"
            };

            try
            {
                IsCreate(customerItemModel.OperationResult);
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(customerItemModel));
        }
        public ActionResult Delete(CustomerItemModel customerItemModel)
        {
            try
            {
                if (IsDelete(customerItemModel.OperationResult))
                {
                    if (Application.Delete(customerItemModel.OperationResult, (Customer)customerItemModel.Customer.ToData()))
                    {
                        return(JsonResultSuccess(customerItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            customerItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(customerItemModel.OperationResult));
        }
        public ActionResult Delete(string customerId, string masterEntity = null, string masterKey = null)
        {
            CustomerItemModel customerItemModel = new CustomerItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(customerItemModel.OperationResult))
                {
                    Customer customer = Application.GetById(customerItemModel.OperationResult, new object[] { customerId });
                    if (customer != null)
                    {
                        customerItemModel.Customer = new CustomerViewModel(customer);

                        return(ZPartialView("CRUD", customerItemModel));
                    }
                }
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(customerItemModel.OperationResult));
        }
Пример #8
0
        public ActionResult Delete(string customerId)
        {
            CustomerItemModel customerItemModel = new CustomerItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Customer             = new CustomerViewModel(),
                ControllerAction     = "Delete"
            };

            try
            {
                CustomerDTO customerDTO = Application.GetById(customerItemModel.OperationResult, new object[] { customerId });
                if (customerDTO != null)
                {
                    customerItemModel.Customer = new CustomerViewModel(customerDTO);
                }
            }
            catch (Exception exception)
            {
                customerItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(customerItemModel));
        }