Пример #1
0
        //JSON Actions

        //GET: GetDistricts
        public ActionResult GetDistricts(int CityId)
        {
            return(Json(
                       LocationWalker.GetDistrict(CityId).Select(s => new SelectListItem {
                Value = s.Id.ToString(), Text = s.Title
            })
                       , JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        //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));
        }
Пример #3
0
 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));
 }
Пример #4
0
        // 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));
        }
Пример #5
0
        //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));
        }