示例#1
0
        public IActionResult Order(ReportModel model)
        {
            var carList = new List <CarViewModel>();
            var orders  = _orderLogic.Read(new OrderBindingModel
            {
                ClientId = Program.Client.Id,
                DateFrom = model.From,
                DateTo   = model.To
            });
            var cars = _carLogic.Read(null);

            foreach (var order in orders)
            {
                foreach (var car in cars)
                {
                    carList.Add(car);
                }
            }
            ViewBag.Cars   = carList;
            ViewBag.Orders = orders;
            string fileName = "pdfreport.pdf";

            if (model.SendMail)
            {
                _reportLogic.SaveCarsSparesToPdfFile(fileName, Program.Client.Id, Program.Client.Mail);
            }
            return(View());
        }