public override ActionResult Index(NewsBlock currentBlock)
        {
            NewsContainer newsContainer = null;

            if (!ContentReference.IsNullOrEmpty(currentBlock.NewsContainer))
            {
                newsContainer = _contentLoader.Get <NewsContainer>(currentBlock.NewsContainer);
            }

            var model = new NewsViewModel
            {
                News = GetNews(newsContainer)
            };

            return(PartialView(model));
        }
Beispiel #2
0
        public object getNews()
        {
            int loggedUserId = runAuthenticate();

            if (loggedUserId > 0)
            {
                GeoPoint      userLocation = DBUtils.getUserLocation(sqlConnection, loggedUserId);
                NewsContainer nc           = new NewsContainer();
                nc.Events = DBUtils.getEventsNearby(sqlConnection, new EventsNearbyFilter(userLocation.Latitude, userLocation.Longitude, 10, 34));
                nc.Users  = DBUtils.getUsersNearby(sqlConnection, new UsersNearbyFilter(userLocation.Latitude, userLocation.Longitude, 34), loggedUserId);
                nc.News   = DBUtils.getNews(sqlConnection);
                return(nc);
            }
            else
            {
                return(getAuthorizationErrorStatus(true));
            }
        }
Beispiel #3
0
 void ShowNewsEventSnapshot(NewsContainer nc)
 {
     MessageBus.Current.SendMessage(nc.Event, "Snapshot");
 }
 private IEnumerable <NewsPage> GetNews(NewsContainer newsContainer)
 {
     return(_contentLoader.GetChildren <NewsPage>(newsContainer.ContentLink));
 }