예제 #1
0
        public virtual ActionResult City(string urlName)
        {
            City city;

            if (urlName == null)
            {
                var cityTC = UserSettingsService.CityTC;
                if (cityTC == null || cityTC == Cities.Moscow)
                {
                    return(Redirect(MainMenu.Urls.Locations));
                }
                city = CityService.GetByPK(cityTC);
            }
            else
            {
                city = CityService.GetAll().ByUrlName(urlName);
            }
            if (city == null)
            {
                return(Redirect(MainMenu.Urls.Locations));
            }
            var model =
                new CityVM {
                City      = city,
                Complexes = ComplexService.GetAll().ByCity(city.City_TC).ToList(),
                Locations = SimplePageService.GetAll().BySysName(SimplePages.Locations),
                Cities    = CityService.GetAll()
                            .Where(c => c.City_TC != city.City_TC).ToList(),
                Groups = GroupService.GetPlannedAndNotBegin().Where(x => x.WebinarExists).Take(20).ToList()
            };

            return(View(model));
        }
예제 #2
0
        public virtual ActionResult Complex(string urlName)
        {
            ComplexService.LoadWith(b => b.Load(x => x.BranchOffice, x => x.Admin).And <BranchOffice>(x => x.City));
            var complex = ComplexService.GetAll().ByUrlName(urlName);

            if (complex == null)
            {
                return(null);
            }
            if (complex.Complex_TC == Cities.Complexes.Partners)
            {
                return(Redirect(SimplePages.FullUrls.Partners));
            }
            if (!complex.IsPublished)
            {
                return(RedirectToAction(() => City(complex.BranchOffice.City.UrlName)));
            }
            var responses = ResponseService.GetAll()
                            .IsActive().Where(x => x.Complex_TC == complex.Complex_TC)
                            .OrderByDescending(x => x.UpdateDate).ToList();
            var otherComplexes = ComplexService.GetAll(x => x.IsPublished &&
                                                       x.UrlName != urlName).ToList();
            var model = new ComplexVM
            {
                Complex         = complex,
                OtherComplexes  = otherComplexes,
                Responses       = responses,
                NearestGroupSet = GroupService.GetNearestGroups(complex),
                GeoLocation     = Cities.Complexes.GeoLocations.GetValueOrDefault(complex.Complex_TC)
            };

            return(MView(Views.Locations.Complex, model));
        }
예제 #3
0
 private List <Complex> GetComplexes()
 {
     return(ComplexService.GetAll(x => x.IsPublished).ToList());
 }