public async Task <IActionResult> Get([FromQuery] DriversResourceParameters driversResourceParameters)
        {
            _logger.LogInformation("API ENTRY: Inside get all drivers API call.");
            var drivers = await _driversService.GetDrivers(driversResourceParameters);

            return(Ok(drivers));
        }
Esempio n. 2
0
        private void InitializeDocumentForUpsert(string action)
        {
            // Initialize dropdowns
            Drivers          = driversService.GetDrivers();
            Policemen        = nomenclatureService.GetPolicemen();
            Violations       = nomenclatureService.GetViolations();
            ChosenViolations = new ObservableCollection <Violation>();

            if (action != "Insert")
            {
                PropertyCopy.Copy(SelectedDocument, UpsertedDocument);
            }
            else
            {
                UpsertedDocument = new Document();
            }

            // Init violations
            if (UpsertedDocument.Violations != null)
            {
                UpsertedDocument.Violations.ForEach(v => ChosenViolations.Add(v));
            }

            // Init date
            if (UpsertedDocument.Date == new DateTime())
            {
                UpsertedDocument.Date = DateTime.Now;
            }
        }
Esempio n. 3
0
        private void SearchDrivers(object obj)
        {
            var result = driversService.GetDrivers().Where(d =>
                                                           (SearchEgn == string.Empty || d.Egn.Contains(SearchEgn)) &&
                                                           (SearchFullName == string.Empty || d.FullName.Contains(SearchFullName))).ToList();

            Drivers = new ObservableCollection <Driver>();
            result.ForEach(r => Drivers.Add(r));
        }
Esempio n. 4
0
        public DriversViewModel()
        {
            driversService = NinjectConfig.Kernel.Get <IDriversService>();
            Drivers        = new ObservableCollection <Driver>(driversService.GetDrivers());

            SearchDriverCommand = new RelayCommand(SearchDrivers);
            InsertDriverCommand = new RelayCommand(InsertDriver);
            UpdateDriverCommand = new RelayCommand(UpdateDriver);
            DeleteDriverCommand = new RelayCommand(DeleteDriver);
            OpenEditorCommand   = new RelayCommand(OpenEditor);

            SearchEgn = SearchFullName = string.Empty;
        }