public async Task <IActionResult> Billing(List <string> CodeList)
        {
            var result = await _saleService.Billing(CodeList);

            if (result.Success)
            {
                return(Ok(result.Data));
            }
            return(BadRequest(result.Message));
        }
        public async Task <IDataResult <Bill> > BuyProduct(string[] CodeList)
        {
            try
            {
                List <string> OutOfStock = new List <string>();
                double        price      = 0.0;
                bool          isNotNull  = CodeList != null ? true : false;
                if (isNotNull)
                {
                    for (int i = 0; i < CodeList.Length; i++)
                    {
                        var product = await _dbContext.Products.Where(x => x.Code == CodeList[i]).FirstOrDefaultAsync();

                        if (product != null && product.StockAmount != 0)
                        {
                            product.StockAmount--;
                            product.UpdatedDate = DateTime.UtcNow + TimeSpan.FromHours(3);
                            price += product.Price;

                            await _dbContext.SaveChangesAsync();
                        }
                        if (product != null && product.StockAmount == 0)
                        {
                            OutOfStock.Add(product.Code.ToString());
                        }
                    }
                    if (OutOfStock.Count > 0)
                    {
                        return(new FailDataResult <Bill>(OutOfStock + ": Bu ürünler stokta yok."));
                    }
                    else
                    {
                        var billResult = _saleService.Billing(CodeList.ToList()).Result;
                        return(new SuccessDataResult <Bill>(billResult.Data));
                    }
                }
                return(new FailDataResult <Bill>("Liste boş."));
            }
            catch (Exception ex)
            {
                return(new FailDataResult <Bill>("Satış gerçekleşmedi. " + ex.Message.ToString()));
            }
        }