public async Task <IActionResult> PutPrices(string id, PricesDto prices)
        {
            if (id != prices.PricesId)
            {
                return(BadRequest());
            }

            _context.Entry(prices).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PricesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <PricesDto> > PostPrice(PricesDto prices)
        {
            await _pricesRepository.AddAsync(_mapper.Map <Prices>(prices));

            await _unitOfWorkPrices.CommitAsync(_cancellationToken);

            //_context.Prices.Add(prices);
            //await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPrices", new { id = prices.PricesId }, prices));
        }
        public async Task <ActionResult> Prices(int ProductId, [FromBody] PricesDto prices)
        {
            try
            {
                await _productService.SetProductPriceAsync(new Dictionary <string, object>()
                {
                    { "ProductId", ProductId },
                    { "ProductPrice", prices.ProductPrice },
                    { "PriceCreationUser", prices.PriceCreationUser }
                });

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <ActionResult <PricesDto> > GetPricesCreated(string type, double price)
        {
            if (!string.IsNullOrWhiteSpace(type) && price > 0)
            {
                var prices = new PricesDto()
                {
                    PricesId = Guid.NewGuid().ToString(),
                    Type     = type,
                    Price    = price
                };
                await _pricesRepository.AddAsync(_mapper.Map <Prices>(prices));

                await _unitOfWorkPrices.CommitAsync(_cancellationToken);

                //_context.Prices.Add(prices);
                //await _context.SaveChangesAsync();

                return(CreatedAtAction("GetPrices", new { id = prices.PricesId }, prices));
            }
            else
            {
                return(NotFound());
            }
        }