public ActionResult Report(int?year, int?month) { int status = 0; #region MonthList ViewBag.Months ViewBag.Months = new SelectList(Enumerable.Range(1, 12).Select(x => new SelectListItem() { Text = CultureInfo.CurrentCulture.DateTimeFormat.AbbreviatedMonthNames[x - 1], Value = x.ToString() }), "Value", "Text"); #endregion #region YearList ViewBag.Years List <int> years = new List <int>(); for (int i = DateTime.Today.Year; i >= 2000; i--) { years.Add(i); } ViewBag.Years = years; #endregion if (year != null && month != null) { status = 1; List <IncomeMonthlyViewModel> incomes = IncomeManager.LoadIncomeMonthly((int)year, (int)month); if (incomes.Count > 0) { ViewBag.IncomeMonthlyList = incomes; ViewBag.Records = incomes.Count(); status = 2; } } ViewBag.Status = status; return(View()); }