Ejemplo n.º 1
0
        public async Task <ActionResult <int> > UpdatePriceForProduct([FromBody] ProductUpdateDto updateModel, int id)
        {
            try
            {
                var entity = await _productsRepo.FindByIdAsync(id);

                var product = updateModel.ToProductEntity(entity);

                _productsRepo.Update(product);
                await _productsRepo.SaveChangesAsync();

                var item = new ProductsDto(product);

                //  ProductionBusinessLogic.Queue_Send(item).Wait();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to update price!"));
            }
        }