public IActionResult SatinAl(SatinAlViewModel satinmodel)
        {
            List <OrderTable> ordering = new List <OrderTable>();
            List <Order>      orders   = new List <Order>();
            string            amount   = satinmodel.Amount.ToString();
            int productid = satinmodel.product_id;

            string[] amountArray = amount.Split(',');
            count = amountArray.Length;
            if (Checkproduct(amount, productid) == false)
            {
                foreach (var item in amountArray)
                {
                    orders.Add(new Order {
                        ProductId = satinmodel.product_id, Amount = satinmodel.Amount, UserId = _userManager.GetUserId(HttpContext.User)
                    });
                }
                foreach (var item in orders)
                {
                    _context.Orders.Add(item);
                    _context.SaveChanges();
                }
                TempData["Success"] = "Product Sepette, Kontrol ediniz";
            }
            else
            {
                TempData["Message"] = "Sepete eklenemedi, ürün kalmamış olabilir";
            }
            return(RedirectToAction("SatinAl"));
        }
        public IActionResult SatinAl(int id)
        {
            SatinAlViewModel vm = new SatinAlViewModel();
            var item            = _context.Products.Where(a => a.productId == id).FirstOrDefault();

            vm.Amount       = item.Amount;
            vm.description  = item.Description;
            vm.price        = item.Price;
            vm.product_name = item.Name;
            vm.type_name    = item.TypeName;
            vm.product_id   = item.productId;
            return(View(vm));
        }