//Cập nhật Brand
        public async Task <bool> Update(ColorCodeDto model)
        {
            var colorCode = _mapper.Map <ColorCode>(model);

            _colorCodeRepository.Update(colorCode);
            return(await _colorCodeRepository.SaveAll());
        }
 public async Task <IActionResult> Update(ColorCodeDto colorCodeIngredientDto)
 {
     if (await _colorCodeService.Update(colorCodeIngredientDto))
     {
         return(NoContent());
     }
     return(BadRequest($"Updating colorCode {colorCodeIngredientDto.ID} failed on save"));
 }
        public async Task <IActionResult> Create(ColorCodeDto colorCodeIngredientDto)
        {
            if (await _colorCodeService.CheckExists(colorCodeIngredientDto.ID))
            {
                return(BadRequest("ColorCode ID already exists!"));
            }
            //var username = User.FindFirst(ClaimTypes.Name).Value;
            //colorCodeIngredientDto.Updated_By = username;
            if (await _colorCodeService.Add(colorCodeIngredientDto))
            {
                return(NoContent());
            }

            throw new Exception("Creating the colorCode failed on save");
        }