public IActionResult AddToCart(int id)
        {
            var product = _ctx.Product.SingleOrDefault(p => p.ProductId == id);

            if (product != null)
            {
                //var userId = /*int.Parse*/(User.FindFirstValue(ClaimTypes.NameIdentifier).ToString());
                //var userId = _ctx.Users.Where(p=>p.Id==);



                var order = _ctx.Order.FirstOrDefault(o => o.UserName == User.Identity.Name && !o.IsFinaly);
                if (order != null)
                {
                    var orderDetail =
                        _ctx.orderdetails.FirstOrDefault(d =>
                                                         d.OrderId == order.OrderId && d.ProductId == product.ProductId);
                    if (orderDetail != null)
                    {
                        orderDetail.Count += 1;
                        _ctx.Update(orderDetail);
                    }
                    else
                    {
                        _ctx.orderdetails.Add(new OrderDetail()
                        {
                            OrderId   = order.OrderId,
                            ProductId = product.ProductId,
                            Price     = product.Price,
                            Count     = 1
                        });
                    }
                }
                else
                {
                    order = new Order()
                    {
                        Sum        = product.Price,
                        productId  = id,
                        IsFinaly   = false,
                        CreateDate = DateTime.Now,
                        UserName   = User.Identity.Name
                    };
                    _ctx.Order.Add(order);
                    _ctx.SaveChanges();
                    _ctx.orderdetails.Add(new OrderDetail()
                    {
                        OrderId   = order.OrderId,
                        ProductId = product.ProductId,
                        Price     = product.Price,
                        Count     = 1
                    });
                }

                _ctx.SaveChanges();
                UpdateSumOrder(order.OrderId);
            }


            return(RedirectToAction("ShowOrder"));
        }
 public void GetAll(Filess Filee)
 {
     _context.Filesses.Add(Filee);
     _context.SaveChanges();
 }