Ejemplo n.º 1
0
        public ActionResult Index(int?page)
        {
            var calendar  = new Calendar();
            var entries   = calendar.GetFutureEvents(10);
            var viewmodel = new BlogSummaryViewData(baseviewmodel)
            {
                events = entries
            };

            if (!page.HasValue || page.Value < 0)
            {
                page = 0;
            }
            var skipcount = page.Value * NEWS_COUNT;
            var news      = repository.GetBlogs().Where(x => x.ispublic);
            var total     = news.Count();

            var newspanel = new NewsPanelViewModel();

            newspanel.page     = page.Value;
            newspanel.news     = news.OrderByDescending(x => x.created).Skip(skipcount).Take(NEWS_COUNT).ToModel();
            newspanel.hasNewer = page != 0;
            if (newspanel.news.Count() + skipcount < total)
            {
                newspanel.hasOlder = true;
            }
            viewmodel.newspanel = newspanel;

            return(View(viewmodel));
        }
 public NewsPanelPage()
 {
     InitializeComponent();
     BindingContext = new NewsPanelViewModel(Navigation);
 }