Пример #1
0
        public IActionResult SimpleSearch(DateTime?minDate, DateTime?maxDate)
        {//se a data nao for informada, ele faz a busca desde o primeiro dia do ano até o dia atual da busca
            if (!minDate.HasValue)
            {
                minDate = new DateTime(DateTime.Now.Year, 1, 1);
            }
            if (!maxDate.HasValue)
            {
                maxDate = DateTime.Now;
            }//passando as datas minima e maxima para a view
            ViewData["minDate"] = minDate.Value.ToString("yyyy-MM-dd");
            ViewData["maxDate"] = maxDate.Value.ToString("yyyy-MM-dd");
            var result = _salesRecordService.FindByDate(minDate, maxDate);

            return(View(result));
        }
        public async Task <IActionResult> SimpleSearch(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 _salesRecordService.FindByDate(minDate, maxDate);

            return(View(result));
        }