public ActionResult DetailsOfMonthList(DateTime?DateOfMonth) { RentInformatioViewModel rentViewModel = new RentInformatioViewModel(); if (DateOfMonth != null) { //ViewBag.DetailsOfMonth = db.RenstInformations.Where(x => x.Date.Value.Month == DateOfMonth.Value.Month).GroupBy(x => x.Date).ToList(); ViewBag.TotalMonthOfAmmount = db.RenstInformations.Where(x => x.Date.Value.Month == DateOfMonth.Value.Month).Sum(x => x.Amount); ViewBag.DetailsOfMonth = db.RenstInformations.Where(x => x.Date.Value.Month == DateOfMonth.Value.Month).ToList(); return(View("Details")); } ViewBag.TotalMonthOfAmmount = db.RenstInformations.Where(x => x.Date.Value.Month == DateTime.Now.Month).Sum(x => x.Amount); ViewBag.DetailsOfMonth = db.RenstInformations.Where(x => x.Date.Value.Month == DateTime.Now.Month).ToList(); return(View("Details")); }
public ActionResult Index(DateTime?DateOfMonth) { RentInformatioViewModel rentViewModel = new RentInformatioViewModel(); if (DateOfMonth != null) { ViewBag.TotalMonthOfAmmount = db.RenstInformations.Where(x => x.Date.Value.Month == DateOfMonth.Value.Month).Sum(x => x.Amount); rentViewModel.RentInformations = db.RenstInformations.Where(x => x.Date.Value.Month == DateOfMonth.Value.Month).ToList(); return(View(rentViewModel)); } ViewBag.TotalMonthOfAmmount = db.RenstInformations.Where(x => x.Date.Value.Month == DateTime.Now.Month).Sum(x => x.Amount); rentViewModel.RentInformations = db.RenstInformations.Where(x => x.Date.Value.Month == DateTime.Now.Month).ToList(); return(View(rentViewModel)); }