Beispiel #1
0
        // Actions
        public async Task <IActionResult> Index(string busNum, DateTime startDate, DateTime endDate, string documentType)
        {
            var currentUser = await _userManager.GetUserAsync(User);

            if (currentUser == null)
            {
                return(Challenge());
            }
            RaportsViewModel model = null;

            try
            {
                // Get raports from database
                var raports = await _raportsService.GetSelectedRaportsAsync(busNum, startDate, endDate);

                // Get bus list from database
                List <SelectListItem> busList = new List <SelectListItem>();
                busList = await _raportsService.GetBusListAsync();

                // Put data into a model
                model = new RaportsViewModel()
                {
                    Raports = raports, BusList = busList
                };
            }
            catch (Exception e) { Logs.sendLog(e); }
            //Render view using the model
            if (model != null)
            {
                return(View(model));
            }
            else
            {
                return(BadRequest("Could not find raport."));
            }
        }
Beispiel #2
0
        public RaportsPage()
        {
            InitializeComponent();

            BindingContext = viewModel = new RaportsViewModel();
        }