Ejemplo n.º 1
0
        public ActionResult Update(CategoryItemModel categoryItemModel)
        {
            try
            {
                if (IsUpdate(categoryItemModel.OperationResult))
                {
                    if (IsValid(categoryItemModel.OperationResult, categoryItemModel.Category))
                    {
                        Category category = (Category)categoryItemModel.Category.ToData();
                        if (Application.Update(categoryItemModel.OperationResult, category))
                        {
                            if (categoryItemModel.IsSave)
                            {
                                return(JsonResultSuccess(categoryItemModel.OperationResult,
                                                         Url.Action("Update", "Category", new { CategoryId = category.CategoryId }, Request.Url.Scheme)));
                            }
                            else
                            {
                                return(JsonResultSuccess(categoryItemModel.OperationResult));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                categoryItemModel.OperationResult.ParseException(exception);
            }

            categoryItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(categoryItemModel.OperationResult));
        }
Ejemplo n.º 2
0
        public ActionResult Delete(CategoryItemModel categoryItemModel)
        {
            try
            {
                if (Application.Delete(categoryItemModel.OperationResult, (CategoryDTO)categoryItemModel.Category.ToDTO()))
                {
                    return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                }
            }
            catch (Exception exception)
            {
                categoryItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(categoryItemModel.OperationResult));
        }
Ejemplo n.º 3
0
        public ActionResult Create(string masterEntity = null, string masterKey = null)
        {
            CategoryItemModel categoryItemModel = new CategoryItemModel(ActivityOperations, "Create", masterEntity, masterKey);

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

            return(JsonResultOperationResult(categoryItemModel.OperationResult));
        }
Ejemplo n.º 4
0
        public ActionResult Create()
        {
            CategoryItemModel categoryItemModel = new CategoryItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Category             = new CategoryViewModel(),
                ControllerAction     = "Create"
            };

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

            return(PartialView(categoryItemModel));
        }
Ejemplo n.º 5
0
        public ActionResult Delete(CategoryItemModel categoryItemModel)
        {
            try
            {
                if (IsDelete(categoryItemModel.OperationResult))
                {
                    if (Application.Delete(categoryItemModel.OperationResult, (Category)categoryItemModel.Category.ToData()))
                    {
                        return(JsonResultSuccess(categoryItemModel.OperationResult));
                    }
                }
            }
            catch (Exception exception)
            {
                categoryItemModel.OperationResult.ParseException(exception);
            }

            categoryItemModel.ActivityOperations = ActivityOperations;

            return(JsonResultOperationResult(categoryItemModel.OperationResult));
        }
Ejemplo n.º 6
0
        public ActionResult Delete(int?categoryId)
        {
            CategoryItemModel categoryItemModel = new CategoryItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                Category             = new CategoryViewModel(),
                ControllerAction     = "Delete"
            };

            try
            {
                CategoryDTO categoryDTO = Application.GetById(categoryItemModel.OperationResult, new object[] { categoryId });
                if (categoryDTO != null)
                {
                    categoryItemModel.Category = new CategoryViewModel(categoryDTO);
                }
            }
            catch (Exception exception)
            {
                categoryItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(categoryItemModel));
        }
Ejemplo n.º 7
0
        public ActionResult Delete(int categoryId, string masterEntity = null, string masterKey = null)
        {
            CategoryItemModel categoryItemModel = new CategoryItemModel(ActivityOperations, "Delete", masterEntity, masterKey);

            try
            {
                if (IsDelete(categoryItemModel.OperationResult))
                {
                    Category category = Application.GetById(categoryItemModel.OperationResult, new object[] { categoryId });
                    if (category != null)
                    {
                        categoryItemModel.Category = new CategoryViewModel(category);

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

            return(JsonResultOperationResult(categoryItemModel.OperationResult));
        }