public async Task <IActionResult> RelatorioVendasSimples(DateTime?minDate, DateTime?maxDate) { if (!minDate.HasValue) { minDate = new DateTime(DateTime.Now.Year, 1, 1); } if (!maxDate.HasValue) { maxDate = DateTime.Now; } ViewData["minDate"] = minDate.Value.ToString("yyyy-MM-dd"); ViewData["maxDate"] = maxDate.Value.ToString("yyyy-MM-dd"); var result = await relatorioVendasService.FindByDateAsync(minDate, maxDate); return(View(result)); }
public async Task <IActionResult> RelatorioVendasSimples(DateTime?minDate, DateTime?maxDate, int?page) { if (!minDate.HasValue) { minDate = new DateTime(DateTime.Now.Year, 1, 1); } if (!maxDate.HasValue) { maxDate = DateTime.Now; } ViewData["minDate"] = minDate.Value.ToString("yyyy-MM-dd"); ViewData["maxDate"] = maxDate.Value.ToString("yyyy-MM-dd"); var result = await relatorioVendasService.FindByDateAsync(minDate, maxDate); var pageNumber = page ?? 1; var onePageOfProducts = result.ToPagedList(pageNumber, 10); ViewBag.OnePageOfProducts = onePageOfProducts; return(View(result)); }