public ActionResult Update(SupplierItemModel supplierItemModel)
        {
            try
            {
                if (IsUpdate(supplierItemModel.OperationResult))
                {
                    if (IsValid(supplierItemModel.OperationResult, supplierItemModel.Supplier))
                    {
                        Supplier supplier = (Supplier)supplierItemModel.Supplier.ToData();
                        if (Application.Update(supplierItemModel.OperationResult, supplier))
                        {
                            if (supplierItemModel.IsSave)
                            {
                                return(JsonResultSuccess(supplierItemModel.OperationResult,
                                                         Url.Action("Update", "Supplier", new { SupplierId = supplier.SupplierId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(supplierItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                supplierItemModel.OperationResult.ParseException(exception);
            }

            supplierItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(supplierItemModel.OperationResult));
        }
        public ActionResult Delete(SupplierItemModel supplierItemModel)
        {
            try
            {
                if (Application.Delete(supplierItemModel.OperationResult, (SupplierDTO)supplierItemModel.Supplier.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                supplierItemModel.OperationResult.ParseException(exception);
            }

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

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

            return(JsonResultOperationResult(supplierItemModel.OperationResult));
        }
        public ActionResult Update(SupplierItemModel supplierItemModel)
        {
            try
            {
                if (ValidateModelState(Application.Repository))
                {
                    if (Application.Update(supplierItemModel.OperationResult, (SupplierDTO)supplierItemModel.Supplier.ToDTO()))
                    {
                        return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                    }
                }
            }
            catch (Exception exception)
            {
                supplierItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(supplierItemModel.OperationResult));
        }
        public ActionResult Create()
        {
            SupplierItemModel supplierItemModel = new SupplierItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Supplier             = new SupplierViewModel(),
                ControllerAction     = "Create"
            };

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

            return(PartialView(supplierItemModel));
        }
        public ActionResult Delete(SupplierItemModel supplierItemModel)
        {
            try
            {
                if (IsDelete(supplierItemModel.OperationResult))
                {
                    if (Application.Delete(supplierItemModel.OperationResult, (Supplier)supplierItemModel.Supplier.ToData()))
                    {
                        return(JsonResultSuccess(supplierItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                supplierItemModel.OperationResult.ParseException(exception);
            }

            supplierItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(supplierItemModel.OperationResult));
        }
        public ActionResult Delete(int?supplierId)
        {
            SupplierItemModel supplierItemModel = new SupplierItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Supplier             = new SupplierViewModel(),
                ControllerAction     = "Delete"
            };

            try
            {
                SupplierDTO supplierDTO = Application.GetById(supplierItemModel.OperationResult, new object[] { supplierId });
                if (supplierDTO != null)
                {
                    supplierItemModel.Supplier = new SupplierViewModel(supplierDTO);
                }
            }
            catch (Exception exception)
            {
                supplierItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(supplierItemModel));
        }
        public ActionResult Delete(int supplierId, string masterEntity = null, string masterKey = null)
        {
            SupplierItemModel supplierItemModel = new SupplierItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(supplierItemModel.OperationResult))
                {
                    Supplier supplier = Application.GetById(supplierItemModel.OperationResult, new object[] { supplierId });
                    if (supplier != null)
                    {
                        supplierItemModel.Supplier = new SupplierViewModel(supplier);

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

            return(JsonResultOperationResult(supplierItemModel.OperationResult));
        }