public ActionResult Checkout(FormCollection formCollection)
        {
            // string name = formCollection["txtname"].ToString();
            String ApplicationUserID = User.Identity.GetUserId();

            var result = db.Customer.Where(m => m.ApplicationUserID == ApplicationUserID).FirstOrDefault();
            var result1 = db.PaymentInfo.Where(m => m.CustomerID == result.ID).FirstOrDefault();
            if (result.FirstName == "" || result.LastName == "" || result.Address == "" || result.PhoneNumber == "" || result.City == "" || result.State == "" || result.Country == ""
               || result1.CartNumber == "" || result1.SecurityCode == "")
            {
                return RedirectToAction("CheckOut", new { message = "Please fill all fields before submitting the form" });
            }
            else
            {
                EmailService oEmailService = new EmailService();
                string CartID = Session["CartID"].ToString();

                int CustomerID = db.Customer.Where(m => m.ApplicationUserID == ApplicationUserID).FirstOrDefault().ID;

                Orders oOrders = new Orders() { CustomerID = CustomerID, CartID = CartID, Date = DateTime.Now };

                db.Orders.Add(oOrders);
                db.SaveChanges();
                var items = db.Cart.Include("Products").Where(m => m.cartID == CartID).ToList();
                oEmailService.SendEmailConfirmation(User.Identity.GetUserName());
                return RedirectToAction("ThankYou");
            }
        }
        //public ActionResult InsertCart(int ProductID)
        //{
        //}
        public ActionResult ShowCart(int? ProductID)
        {
            if (User.IsInRole("Admin"))
            {
                RedirectToAction("Index", "Home");
            }
                if (ProductID != null || Session["CartID"] != null)
                {
                    CartViewModel objCarViewModel = new CartViewModel();
                    if (Session["CartID"] == null)
                    {
                        Session.Timeout = 60;
                        EmailService objEmailService = new EmailService();
                        Session["CartID"] = objEmailService.CreateConfirmationToken();
                        int ProdID = Convert.ToInt16(ProductID);
                        int Price = db.Products.Find(ProductID).Price;

                        Cart objCart = new Cart { ProductID = ProdID, Quantity = 1, cartID = Session["CartID"].ToString(), Price = Price };

                        db.Cart.Add(objCart);
                        db.SaveChanges();

                    }
                    else
                    {
                        if (ProductID != null)
                        {
                            if (ProductExist(Convert.ToInt32(ProductID)))
                            {

                            }
                            else
                            {
                                int ProdID = Convert.ToInt16(ProductID);
                                int Price = db.Products.Find(ProductID).Price;
                                Cart objCart = new Cart { ProductID = ProdID, Quantity = 1, cartID = Session["CartID"].ToString(), Price = Price };

                                db.Cart.Add(objCart);
                                db.SaveChanges();
                            }
                        }
                        else
                        {

                        }

                    }
                    if (Session["CartID"] != null)
                    {

                        string CartID = Session["CartID"].ToString();
                        objCarViewModel.Carts = db.Cart.Include("Products").Where(m => m.cartID == CartID).ToList();
                        objCarViewModel.Subtotal = db.Cart.Where(m => m.cartID == CartID).Select(g => g.Price).Sum();

                        foreach (var item in objCarViewModel.Carts)
                        {

                        }

                    }
                    return View(objCarViewModel);
                }
                else
                {
                    ViewBag.Empty = true;
                    return View();

                }
        }