//[Authorize]
        public async Task <IActionResult> PutSaleProductCategory(int id, List <SaleProductCategoryModel> SaleProductCategoryModelList)
        {
            var  result       = new Result <string>();
            Type prodCateType = typeof(SaleProductCategory);

            foreach (var cate in SaleProductCategoryModelList)
            {
                if (cate.CategoryId == 0)
                {
                    SaleProductCategory SaleProductCategory = new SaleProductCategory();
                    _mapper.Map(cate, SaleProductCategory);
                    await _context.SaleProductCategory.AddAsync(SaleProductCategory);
                }
                else
                {
                    var existProdCategory = await _context.SaleProductCategory.FirstOrDefaultAsync(x => x.CategoryId == cate.CategoryId);

                    UpdateTable(cate, prodCateType, existProdCategory);
                }
            }

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                result.ErrorMessage = e.Message;
                result.IsSuccess    = false;
                return(BadRequest(result));
            }
            return(Ok(result));
        }
        public async Task <ActionResult <SaleProductCategory> > PostSaleProductCategory(SaleProductCategoryModel SaleProductCategoryModel)
        {
            var result = new Result <SaleProductCategory>();
            SaleProductCategory SaleProductCategory = new SaleProductCategory();

            _mapper.Map(SaleProductCategoryModel, SaleProductCategory);
            try
            {
                result.Data = SaleProductCategory;
                await _context.SaleProductCategory.AddAsync(SaleProductCategory);

                await _context.SaveChangesAsync();
            }
            catch (Exception e)
            {
                result.ErrorMessage = e.Message;
                result.IsFound      = false;
            }
            return(Ok(result));
        }