Exemple #1
0
        public async Task <ActionResult <ProductDto> > CreateProduct([FromBody] ProductForCreateDto product)
        {
            _orm.OpenConn();
            var productFromDB = _mapper.Map <Product>(product);

            productFromDB = await _orm.CreateProduct(productFromDB);

            var productDto = _mapper.Map <ProductDto>(productFromDB);
            await _orm.CloseConn();

            return(CreatedAtRoute("GetProductByID", new { productID = productDto.Id }, productDto));
        }