public ActionResult Create(Shipping shipping)
        {
            if (ModelState.IsValid)
            {
                shipping.ShippingID = Guid.NewGuid();
                db.Shippings.Add(shipping);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.OrderID = new SelectList(db.Orders, "OrderID", "OrderID", shipping.OrderID);
            return View(shipping);
        }
        public ActionResult ShippingAddress(Shipping shippingModel)
        {
            try
            {
                if (Session["UserName"] == null)
                    return RedirectToAction("Index");

                string Email = Session["UserName"].ToString();

                Guid userId = db.Users.Where(u => u.EmailID == Email).Single().UsersID;
                Guid orderId = db.Orders.Where(o => o.UsersID == userId).OrderByDescending(o => o.CreateDate).First().OrderID;

                //  generate shipping address

                Shipping shipping = new Shipping();

                shipping.ShippingID = Guid.NewGuid();
                shipping.OrderID = orderId;
                shipping.Address = shippingModel.Address;
                shipping.City = shippingModel.City;
                shipping.State = shippingModel.State;
                shipping.Country = shippingModel.Country;
                shipping.PhoneNumber = shippingModel.PhoneNumber;
                shipping.ZipCode = shippingModel.ZipCode;
                shipping.CreateDate = DateTime.Now;
                shipping.ModifiedDate = DateTime.Now;

                db.Shippings.Add(shipping);
                db.SaveChanges();

                //  send email of orderered products

                return RedirectToAction("Success");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult ShippingAddress()
        {
            try
            {
                if (Session["UserName"] == null)
                    return RedirectToAction("Index");

                string Email = Session["UserName"].ToString();
                var user = db.Users.Where(u => u.EmailID == Email).Single();

                Shipping shipping = new Shipping();
                shipping.Address = user.Address;
                shipping.City = user.City;
                shipping.Country = user.Country;
                shipping.PhoneNumber = user.PhoneNumber;
                shipping.State = user.State;
                shipping.ZipCode = user.ZipCode;

                return View(shipping);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public ActionResult Edit(Shipping shipping)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shipping).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.OrderID = new SelectList(db.Orders, "OrderID", "OrderID", shipping.OrderID);
     return View(shipping);
 }