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); } }
public async Task <IActionResult> UpdateBrand(int id, BrandFormDto dto) { var brand = await _brandBusiness.UpdateBrandAsync(id, dto); return(Ok(brand)); }
public async Task <IActionResult> CreateBrand(BrandFormDto dto) { var brand = await _brandBusiness.CreateBrandAsync(dto); return(CreatedAtAction(nameof(GetBrand), new { brand.Id }, brand)); }