public async Task <IActionResult> SimpleSearch(DateTime?minDate, DateTime?maxDate, SaleStatus status)
        {
            if (!minDate.HasValue && !maxDate.HasValue)
            {
                minDate = new DateTime(DateTime.Now.Year, 1, 1);
                maxDate = DateTime.Now;
            }
            ViewData["minDate"] = minDate.Value.ToString("yyyy-MM-dd");
            ViewData["maxDate"] = maxDate.Value.ToString("yyyy-MM-dd");

            var result = await _salesRecordService.FindByDateAsync(minDate, maxDate, status);

            return(View(result));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SimpleSearch(DateTime?minDate, DateTime?maxDate)
        {
            if (minDate == null)
            {
                minDate = new DateTime(DateTime.Now.Year, 1, 1);
            }
            if (maxDate == null)
            {
                maxDate = DateTime.Now;
            }
            ViewData["minData"] = minDate.Value.ToString("yyyy-MM-dd");
            ViewData["maxData"] = maxDate.Value.ToString("yyyy-MM-dd");
            var result = await _salesService.FindByDateAsync(minDate, maxDate);

            return(View(result));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Search(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 list = await _salesRecordsService.FindByDateAsync(minDate, maxDate);

            return(View(list));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> SimpleSearch(DateTime?min, DateTime?max)
        {
            if (!min.HasValue)
            {
                min = new DateTime(DateTime.Now.Year, 1, 1);
            }
            if (!max.HasValue)
            {
                max = DateTime.Now;
            }
            ViewData["min"] = min.Value.ToString("yyyy-MM-dd");
            ViewData["max"] = max.Value.ToString("yyyy-MM-dd");

            var result = await _salesRecordsService.FindByDateAsync(min, max);

            return(View(result));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> SimpleSearch(DateTime?minDate, DateTime?maxDate)
        {
            if (!minDate.HasValue)
            {
                minDate = new DateTime(DateTime.Today.Year, 1, 1);
            }

            if (!maxDate.HasValue)
            {
                maxDate = DateTime.Today;
            }

            ViewData["minDate"] = minDate.Value.ToString("yyyy-MM-dd"); // html5 date input format = yyyy-MM-dd
            ViewData["maxDate"] = maxDate.Value.ToString("yyyy-MM-dd");

            List <SalesRecord> sales = await _salesRecordsService.FindByDateAsync(minDate, maxDate);

            return(View(sales));
        }
Exemplo n.º 6
0
        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;
            }

            //passando as datas pra view
            ViewData["minDate"] = minDate.Value.ToString("yyy-MM-dd");
            ViewData["maxDate"] = maxDate.Value.ToString("yyy-MM-dd");

            var result = await _salesRecordsService.FindByDateAsync(minDate, maxDate);

            return(View(result));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> SimpleSearch(DateTime?initialDate, DateTime?finalDate)
        {
            List <SalesRecord> records = await _salesRecordsService.FindByDateAsync(initialDate, finalDate);

            if (!initialDate.HasValue)
            {
                initialDate = new DateTime(DateTime.Now.Year, 1, 1);
            }

            if (!finalDate.HasValue)
            {
                finalDate = DateTime.Now;
            }

            ViewData["initialDate"] = initialDate.Value.ToString("yyyy-MM-dd");
            ViewData["finalDate"]   = finalDate.Value.ToString("yyyy-MM-dd");

            return(View(records));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> SimpleSearch(DateTime?minDate, DateTime?maxDate)
        {
            try
            {
                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 _salesRecordsService.FindByDateAsync(minDate, maxDate);

                return(View(result));
            }
            catch (ApplicationException e)
            {
                return(RedirectToAction(nameof(Error), new { message = e.Message }));
            }
        }
Exemplo n.º 9
0
 public async Task <IActionResult> SimpleSearch(DateTime?minDate, DateTime?maxDate)
 {
     return(View(await _salesRecordsService.FindByDateAsync(minDate, maxDate)));
 }