// GET: Customers/CreateShipTo

        public ActionResult CreateShipTo(int id)
        {
            ViewBag.CustomerId        = new SelectList(db.Customers.Where(c => c.VendorId == 74), "CustomerId", "Names", id);
            ViewBag.CountryId         = new SelectList(CombosHelper.GetCountry(), "CountryId", "Description");
            ViewBag.TerritoryEpicorId = new SelectList(CombosHelper.GetTerritory(), "TerritoryEpicorId", "TerritoryDesc");

            return(View());
        }
        // GET: Contacts/Edit/5
        public ActionResult EditContact(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Contact contact = db.Contacts.Find(id);

            if (contact == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ShipToId  = new SelectList(db.ShipToes.Where(s => s.ShipToId == contact.ShipToId), "ShipToId", "ShipToName", contact.ShipToId);
            ViewBag.CountryId = new SelectList(CombosHelper.GetCountry(), "CountryId", "Description", contact.CountryId);
            return(View(contact));
        }
        public ActionResult EditShipTo(int?id)
        {
            ShipTo shipTo = db.ShipToes.Find(id);

            if (shipTo == null)
            {
                return(HttpNotFound());
            }

            ViewBag.CustomerId        = new SelectList(db.Customers.Where(c => c.CustomerId == shipTo.CustomerId), "CustomerId", "Names", shipTo.CustomerId);
            ViewBag.CountryId         = new SelectList(CombosHelper.GetCountry(), "CountryId", "Description", shipTo.CountryId);
            ViewBag.TerritoryEpicorId = new SelectList(CombosHelper.GetTerritory(), "TerritoryEpicorId", "TerritoryDesc", shipTo.TerritoryEpicorId);

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var shiptoview = new ShipToView
            {
                ShipToId           = shipTo.ShipToId,
                ShipToNum          = shipTo.ShipToNum,
                ShipToName         = shipTo.ShipToName,
                CustomerId         = shipTo.CustomerId,
                CustNum            = shipTo.CustNum,
                Company            = shipTo.Company,
                Address            = shipTo.Address,
                State              = shipTo.State,
                Email              = shipTo.Email,
                Country            = shipTo.Country,
                CountryId          = shipTo.CountryId,
                SincronizadoEpicor = shipTo.SincronizadoEpicor,
                VendorId           = shipTo.VendorId,
                City     = shipTo.City,
                PhoneNum = shipTo.PhoneNum,
                Contacts = shipTo.Contacts.ToList(),
            };

            return(View(shiptoview));
        }
 // GET: Contacts/Create
 public ActionResult CreateContact(int id)
 {
     ViewBag.ShipToId  = new SelectList(db.ShipToes.Where(s => s.ShipToId == id), "ShipToId", "ShipToName", id);
     ViewBag.CountryId = new SelectList(CombosHelper.GetCountry(), "CountryId", "Description");
     return(View());
 }