public ActionResult DeleteConfirmed(int id)
        {
            CustomersShipAddress customersshipaddress = db.CustomersShipAddresses.Find(id);

            db.CustomersShipAddresses.Remove(customersshipaddress);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //
        // GET: /CustomersShipAddressAdmin/Details/5

        public ActionResult Details(int id = 0)
        {
            CustomersShipAddress customersshipaddress = db.CustomersShipAddresses.Find(id);

            if (customersshipaddress == null)
            {
                return(HttpNotFound());
            }
            return(View(customersshipaddress));
        }
 public ActionResult Edit(CustomersShipAddress customersshipaddress)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customersshipaddress).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customersshipaddress));
 }
        public ActionResult Create(CustomersShipAddress customersshipaddress)
        {
            if (ModelState.IsValid)
            {
                db.CustomersShipAddresses.Add(customersshipaddress);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customersshipaddress));
        }
        //
        // GET: /PayPalPayment/
        public ActionResult Index(int id = 0)
        {
            Payments                payment         = db.Payments.Find(id);
            SalesOrder              salesorder      = null;
            CustomersShipAddress    shipto          = null;
            CustomersContactAddress customeraddress = null;

            //Display Payment data
            if (payment != null)
            {
                //Get the sales order
                salesorder = db.SalesOrders.Where(slor => slor.SalesOrderNo == payment.SalesOrderNo).FirstOrDefault <SalesOrder>();
                if (salesorder != null)
                {
                    //Get the customer
                    customeraddress = db.CustomersContactAddresses.Where(ctad => ctad.CustomerId == salesorder.CustomerId).FirstOrDefault <CustomersContactAddress>();
                    if (customeraddress != null)
                    {
                        ViewBag.Company = customeraddress.CompanyName;
                    }

                    //Get the ship to address
                    shipto = db.CustomersShipAddresses.Where(ctst => ctst.CustomerId == salesorder.CustomerId).FirstOrDefault <CustomersShipAddress>();
                    if (shipto != null)
                    {
                        ViewBag.FirstName   = shipto.FirstName;
                        ViewBag.LastName    = shipto.LastName;
                        ViewBag.AddressHlp4 = string.Format("{0}", shipto.Address1);
                        ViewBag.AddressHlp5 = string.Format("{0} {1} {2}", shipto.City, shipto.State, shipto.Zip);
                    }
                }
            }
            else
            {
                return(RedirectToAction("Index", "Payment"));
            }

            return(View(payment));
        }