示例#1
0
 public async Task <BrandDto> UpdateBrandAsync(int id, BrandFormDto dto)
 {
     try
     {
         return(await UpdateAsync <BrandDto>(id, dto));
     }
     catch (DbUpdateException ex)
     {
         HandleDuplicateNameException(ex, dto.Name);
         return(null);
     }
 }
示例#2
0
        public async Task <IActionResult> UpdateBrand(int id, BrandFormDto dto)
        {
            var brand = await _brandBusiness.UpdateBrandAsync(id, dto);

            return(Ok(brand));
        }
示例#3
0
        public async Task <IActionResult> CreateBrand(BrandFormDto dto)
        {
            var brand = await _brandBusiness.CreateBrandAsync(dto);

            return(CreatedAtAction(nameof(GetBrand), new { brand.Id }, brand));
        }