public ActionResult Update(RegionItemModel regionItemModel)
        {
            try
            {
                if (IsUpdate(regionItemModel.OperationResult))
                {
                    if (IsValid(regionItemModel.OperationResult, regionItemModel.Region))
                    {
                        Region region = (Region)regionItemModel.Region.ToData();
                        if (Application.Update(regionItemModel.OperationResult, region))
                        {
                            if (regionItemModel.IsSave)
                            {
                                return(JsonResultSuccess(regionItemModel.OperationResult,
                                                         Url.Action("Update", "Region", new { RegionId = region.RegionId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(regionItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                regionItemModel.OperationResult.ParseException(exception);
            }

            regionItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(regionItemModel.OperationResult));
        }
        public ActionResult Delete(RegionItemModel regionItemModel)
        {
            try
            {
                if (Application.Delete(regionItemModel.OperationResult, (RegionDTO)regionItemModel.Region.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                regionItemModel.OperationResult.ParseException(exception);
            }

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

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

            return(JsonResultOperationResult(regionItemModel.OperationResult));
        }
        public ActionResult Update(RegionItemModel regionItemModel)
        {
            try
            {
                if (ValidateModelState(Application.Repository))
                {
                    if (Application.Update(regionItemModel.OperationResult, (RegionDTO)regionItemModel.Region.ToDTO()))
                    {
                        return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                    }
                }
            }
            catch (Exception exception)
            {
                regionItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(regionItemModel.OperationResult));
        }
        public ActionResult Create()
        {
            RegionItemModel regionItemModel = new RegionItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Region           = new RegionViewModel(),
                ControllerAction = "Create"
            };

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

            return(PartialView(regionItemModel));
        }
        public ActionResult Delete(RegionItemModel regionItemModel)
        {
            try
            {
                if (IsDelete(regionItemModel.OperationResult))
                {
                    if (Application.Delete(regionItemModel.OperationResult, (Region)regionItemModel.Region.ToData()))
                    {
                        return(JsonResultSuccess(regionItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                regionItemModel.OperationResult.ParseException(exception);
            }

            regionItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(regionItemModel.OperationResult));
        }
        public ActionResult Delete(int?regionId)
        {
            RegionItemModel regionItemModel = new RegionItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Region           = new RegionViewModel(),
                ControllerAction = "Delete"
            };

            try
            {
                RegionDTO regionDTO = Application.GetById(regionItemModel.OperationResult, new object[] { regionId });
                if (regionDTO != null)
                {
                    regionItemModel.Region = new RegionViewModel(regionDTO);
                }
            }
            catch (Exception exception)
            {
                regionItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(regionItemModel));
        }
        public ActionResult Delete(int regionId, string masterEntity = null, string masterKey = null)
        {
            RegionItemModel regionItemModel = new RegionItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(regionItemModel.OperationResult))
                {
                    Region region = Application.GetById(regionItemModel.OperationResult, new object[] { regionId });
                    if (region != null)
                    {
                        regionItemModel.Region = new RegionViewModel(region);

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

            return(JsonResultOperationResult(regionItemModel.OperationResult));
        }