コード例 #1
0
        //
        // GET: /Home/
        public ActionResult Index()
        {
            var craigslistVM = new CraigslistViewModel();

            _VMBuilder = new CraigslistVMBuilder(new CraigslistManager());

            craigslistVM.States = _VMBuilder.FetchStates();      
            craigslistVM.Countries = _VMBuilder.FetchCountries();
            craigslistVM.Cities = _VMBuilder.FetchCities();
            craigslistVM.Country.BoxDivValue = 1;

            return View(craigslistVM);
        }
コード例 #2
0
        public ActionResult GetCityHomePage(int cityId, string city, string originalCityName)
        {
            var craigslistVM = new CraigslistViewModel();
            _VMBuilder = new CraigslistVMBuilder(new CraigslistManager());
            
            craigslistVM.Categories = _VMBuilder.FetchCategories();
            craigslistVM.Subcategories = _VMBuilder.FetchSubcategories();
         
            craigslistVM.States = _VMBuilder.FetchStates();
            craigslistVM.Countries = _VMBuilder.FetchCountries();
            craigslistVM.Cities = _VMBuilder.FetchCities();

            craigslistVM.City = (from c in craigslistVM.Cities
                                 where c.CityName == originalCityName
                                 select c).FirstOrDefault();

            craigslistVM.State = (from s in craigslistVM.States
                                  where s.StateId == craigslistVM.City.StateId
                                  select s).FirstOrDefault();

            return View(craigslistVM);
        }