public ActionResult EditAddress([Bind(Include = "AddressType,City,Country,PostalCode,Street,Suburb")] ServiceReference.Address add)
        {
            Debug.WriteLine("AddressType:" + add.AddressType);
            int a = add.AddressType;

            ServiceReference.Service1Client address = new ServiceReference.Service1Client();
            address.EditAddress(add);
            List <int> l = new List <int>();

            return(RedirectToAction("Index", "Order", new { quantity = l }));
        }
        public ActionResult CreateAddress([Bind(Include = "AddressType,City,Country,PostalCode,Street,Suburb")] ServiceReference.Address add, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                string AddressTypeValue = form["AddressTypes"];
                Debug.WriteLine("AddressType:" + add.AddressType);
                int a = add.AddressType;
                add.AddressType = Convert.ToInt32(AddressTypeValue);
                var id = Convert.ToInt32(Session["CustomerId"]);
                ServiceReference.Service1Client address = new ServiceReference.Service1Client();
                address.CreateAddress(add, id);

                Session["AddressID"] = add.AddressID;
                List <int> l = new List <int>();

                return(RedirectToAction("Checkout", "Order", new { quantity = l }));
            }
            return(View());
        }
        public ActionResult PartialAddress()
        {
            ServiceReference.Service1Client address = new ServiceReference.Service1Client();
            int add = Convert.ToInt32(Session["AddressID"]);
            var a   = new ServiceReference.Address();

            if (add == 0)
            {
                var customerId = Convert.ToInt32(Session["CustomerId"]);
                a                    = address.GetAddresses(customerId).FirstOrDefault();
                ViewBag.Type         = address.GetAddressType(a.AddressType);
                Session["AddressId"] = a.AddressID;
            }
            else
            {
                a            = address.GetAddress(add);
                ViewBag.Type = address.GetAddressType(a.AddressType);
            }
            return(PartialView(a));
        }
        public ActionResult Register([Bind(Include = "FirstName,LastName,Username,Password")] ServiceReference.Customer cust, [Bind(Include = "AddressType,City,Country,PostalCode,Street,Suburb")] ServiceReference.Address add, [Bind(Include = "ContactType,Contact1")] ServiceReference.Contact cont)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ServiceReference.Service1Client cus = new ServiceReference.Service1Client();
                    cus.Register(cust, add, cont);

                    MembershipUser NewUser = Membership.CreateUser(cust.UserName, cust.Password);
                    FormsAuthentication.SetAuthCookie(cust.FirstName, false);
                    return(RedirectToAction("Index", "Home"));
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("Registration Error", "Registration error: " + e.StatusCode.ToString());
                }
            }

            return(View());
        }