Exemplo n.º 1
0
        public int?Add(CategoryCreateSubmitModel submitModel)
        {
            var category = new Category
            {
                ParentId = submitModel.ParentId,
                Caption  = submitModel.Caption,
                Code     = submitModel.Code
            };

            _categoryRepository.Add(category);
            _categoryRepository.Complate();
            IsError = _categoryRepository.IsError;
            return(category.Id);
        }
Exemplo n.º 2
0
        public IActionResult Create(CategoryCreateSubmitModel submitModel)
        {
            var ajaxResponse = new AjaxResponse();

            var categoryId = _categoryService.Add(submitModel);

            if (!_categoryService.IsError)
            {
                ajaxResponse.IsSuccess = true;
                ajaxResponse.Data      = new
                {
                    CategoryId = categoryId
                };
            }

            return(Json(ajaxResponse));
        }