public async Task <ActionResult> Index(DateTime?fromDate, DateTime?toDate) { if (fromDate == null) { fromDate = DateTime.Now.AddDays(-30); } if (toDate == null) { toDate = DateTime.Now; } var model = await _noticeRepository.GetNoticesWithinDate((DateTime)fromDate, (DateTime)toDate); if (Request.IsAjaxRequest()) { return(PartialView("~/Areas/Student/Views/NoticeBoard/_Notices.cshtml", model)); } return(View(model)); }