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); }
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)); }