Ejemplo n.º 1
0
        public async Task <BrandDto> CreateBrandAsync(CreateBrandParams createBrandParams)
        {
            var newBrand = new Brand
            {
                BrandName = createBrandParams.BrandName
            };

            await _brandRepository.CreateBrandAsync(newBrand);

            return(_mapper.Map <BrandDto>(newBrand));
        }
        public async Task <ActionResult <BrandDto> > CreateBrandAsync(BrandToPostDto brandDto)
        {
            var created = await _brandRepository.CreateBrandAsync(brandDto.ToBrand());

            return(CreatedAtAction(nameof(GetBrandAsync), new { id = created.Id }, created.ToBrandDto()));
        }