コード例 #1
0
        public ActionResult Update(ProductItemModel productItemModel)
        {
            try
            {
                if (IsUpdate(productItemModel.OperationResult))
                {
                    if (IsValid(productItemModel.OperationResult, productItemModel.Product))
                    {
                        Product product = (Product)productItemModel.Product.ToData();
                        if (Application.Update(productItemModel.OperationResult, product))
                        {
                            if (productItemModel.IsSave)
                            {
                                return(JsonResultSuccess(productItemModel.OperationResult,
                                                         Url.Action("Update", "Product", new { ProductId = product.ProductId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(productItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                productItemModel.OperationResult.ParseException(exception);
            }

            productItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(productItemModel.OperationResult));
        }
コード例 #2
0
        public ActionResult Delete(int?productId, int?masterCategoryId = null, int?masterSupplierId = null)
        {
            ProductItemModel productItemModel = new ProductItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Product          = new ProductViewModel(),
                ControllerAction = "Delete",
                MasterCategoryId = masterCategoryId, MasterSupplierId = masterSupplierId
            };

            try
            {
                ProductDTO productDTO = Application.GetById(productItemModel.OperationResult, new object[] { productId });
                if (productDTO != null)
                {
                    productItemModel.Product = new ProductViewModel(productDTO);
                }
            }
            catch (Exception exception)
            {
                productItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(productItemModel));
        }
コード例 #3
0
        public ActionResult Delete(ProductItemModel productItemModel)
        {
            try
            {
                if (Application.Delete(productItemModel.OperationResult, (ProductDTO)productItemModel.Product.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                productItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(productItemModel.OperationResult));
        }
コード例 #4
0
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            ProductItemModel productItemModel = new ProductItemModel(ActivityOperations, "Create", masterEntity, masterKey);

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

            return(JsonResultOperationResult(productItemModel.OperationResult));
        }
コード例 #5
0
        public ActionResult Create(ProductItemModel productItemModel)
        {
            try
            {
                if (ValidateModelState(Application.Repository))
                {
                    if (Application.Create(productItemModel.OperationResult, (ProductDTO)productItemModel.Product.ToDTO()))
                    {
                        return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                    }
                }
            }
            catch (Exception exception)
            {
                productItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(productItemModel.OperationResult));
        }
コード例 #6
0
        public ActionResult Delete(ProductItemModel productItemModel)
        {
            try
            {
                if (IsDelete(productItemModel.OperationResult))
                {
                    if (Application.Delete(productItemModel.OperationResult, (Product)productItemModel.Product.ToData()))
                    {
                        return(JsonResultSuccess(productItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                productItemModel.OperationResult.ParseException(exception);
            }

            productItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(productItemModel.OperationResult));
        }
コード例 #7
0
        public ActionResult Create(int?masterCategoryId = null, int?masterSupplierId = null)
        {
            ProductItemModel productItemModel = new ProductItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Product          = new ProductViewModel(),
                ControllerAction = "Create",
                MasterCategoryId = masterCategoryId, MasterSupplierId = masterSupplierId
            };

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

            return(PartialView(productItemModel));
        }
コード例 #8
0
        public ActionResult Delete(int productId, string masterEntity = null, string masterKey = null)
        {
            ProductItemModel productItemModel = new ProductItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(productItemModel.OperationResult))
                {
                    Product product = Application.GetById(productItemModel.OperationResult, new object[] { productId });
                    if (product != null)
                    {
                        productItemModel.Product = new ProductViewModel(product);

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

            return(JsonResultOperationResult(productItemModel.OperationResult));
        }