//GET: Manage/AddressEdit
        public ActionResult AddressEdit(int id)
        {
            var customerWorker = new CustomerWorker();
            var model          = customerWorker.GetSiteCustomerAddress(id);

            List <Models.Internal.CityModel> cities = LocationWalker.GetCities();

            ViewBag.Cities = cities.Select(s => new SelectListItem {
                Value = s.Id.ToString(), Text = s.Title, Selected = s.Title == model.City
            });
            ViewBag.Districts = LocationWalker.GetDistrict(cities.FirstOrDefault(f => f.Title == model.City).Id).Select(s => new SelectListItem {
                Value = s.Title, Text = s.Title, Selected = s.Title == model.District
            });

            return(View(model));
        }
 public ActionResult AddressEdit(Models.Site.CustomerAddressViewModel model)
 {
     if (ModelState.IsValid)
     {
         model.City = LocationWalker.GetCities().FirstOrDefault(f => f.Id == int.Parse(model.City)).Title;
         var customerWorker = new CustomerWorker();
         customerWorker.UpdateSiteCustomerAddress(model);
         return(RedirectToAction("Address"));
     }
     ViewBag.Cities = LocationWalker.GetCities().Select(s => new SelectListItem {
         Value = s.Id.ToString(), Text = s.Title
     });
     ViewBag.Districts = LocationWalker.GetDistrict(int.Parse(model.City)).Select(s => new SelectListItem {
         Value = s.Title, Text = s.Title
     });
     return(View(model));
 }
        // GET: /Manage/AddAddress
        public ActionResult AddAddress()
        {
            var model = new CustomerAddressViewModel()
            {
                CustomerId = CustomerLayer.Customer.Id,
                IsDefault  = false,
                Status     = 1
            };

            ViewBag.Cities = LocationWalker.GetCities().Select(s => new SelectListItem {
                Value = s.Id.ToString(), Text = s.Title
            });
            ViewBag.Districts = LocationWalker.GetDistrict(1).Select(s => new SelectListItem {
                Value = s.Title, Text = s.Title
            });

            return(View(model));
        }
        //GET: Begin
        public ActionResult Begin()
        {
            var customerWorker = new CustomerWorker();
            var shipmentWorker = new ShipmentWorker();

            ViewBag.Cities = LocationWalker.GetCities().Select(s => new SelectListItem {
                Value = s.Id.ToString(), Text = s.Title
            });
            ViewBag.Districts = LocationWalker.GetDistrict(1).Select(s => new SelectListItem {
                Value = s.Id.ToString(), Text = s.Title
            });

            var orderLayer = OrderLayer.Create();

            orderLayer.Order.Addresses = customerWorker.GetSiteCustomerAddresses(CustomerLayer.Customer.Id, 1);
            orderLayer.Order.Shipments = shipmentWorker.GetSiteShipmentTypes();

            return(View(orderLayer.Order));
        }
        public ActionResult AddAddress(FormCollection frm)
        {
            var model = new CustomerAddressViewModel
            {
                CustomerId = CustomerLayer.Customer.Id,
                City       = LocationWalker.GetCities().FirstOrDefault(f => f.Id == int.Parse(frm["AddressCity"])).Title,
                Detail     = frm["AddressDetail"],
                District   = frm["AddressDistrict"],
                IsDefault  = false,
                PostalCode = frm["AddressPostalCode"],
                Status     = 1,
                Title      = frm["AddressTitle"],
                Town       = frm["AddressTown"]
            };
            CustomerWorker customerWorker = new CustomerWorker();

            customerWorker.InsertSiteCustomerAddress(model);

            return(RedirectToAction("Begin"));
        }