예제 #1
0
        public ActionResult ListArchives(int?Page, int?Year, int?Month)
        {
            int[] years = DataBaseHandler.GetYears();
            ViewBag.Years  = new SelectList(years);
            ViewBag.Months = new SelectList(Enumerable.Range(1, 12));
            StaticPagedList <WeatherEntry> fullData;
            int pageSize   = 50;
            int pageNumber = (Page ?? 1);

            if (Year != null)
            {
                ViewBag.Year = Year;
                if (Month != null)
                {
                    ViewBag.Month = Month;
                    fullData      = DataBaseHandler.GetData(pageNumber, pageSize, (int)Year, (int)Month);
                }
                else
                {
                    fullData = DataBaseHandler.GetData(pageNumber, pageSize, (int)Year);
                }
            }
            else
            {
                fullData = DataBaseHandler.GetData(pageNumber, pageSize);
            }
            return(View(fullData));
        }