public async Task <IActionResult> GetCountries() { var countries = await _countryManager.GetAllCountries(); return(Ok(new ApiResponse <List <CountryModel> >() { Data = countries, Message = "", StatusCode = HttpStatusCode.OK })); }
private void InitForm() { GenderComboBox.Items.AddRange(new string[] { "Male", "Female" }); var banks_list = _bankManager.GetAllBanks(); BankComboBox.DataSource = banks_list; BankComboBox.DisplayMember = "Name"; BankComboBox.ValueMember = "BankID"; var country_list = _countryManager.GetAllCountries(); CountryComboBox.DataSource = country_list; CountryComboBox.DisplayMember = "Name"; CountryComboBox.ValueMember = "CountryID"; }
private void InitFields() { var userinfo = this._userInfoManager.GetUserInfoById(this._user.UserId); this.LoginField.Text = this._user.Login; this.NameField.Text = userinfo.FirstName; this.LastNameField.Text = userinfo.LastName; this.EmailField.Text = userinfo.Email; this.MobilePhoneField.Text = userinfo.MobilePhone; var cardinfo = this._cardInfoMananger.GetCardInfoById(userinfo.BankCardInfoID); var adress_list = this._adressManager.GetAllAdresses(); var country_list = _countryManager.GetAllCountries(); var address = adress_list.FirstOrDefault <AdressDTO>(a => a.AdressID == userinfo.AdressID); var country = country_list.FirstOrDefault <CountryDTO>(c => c.CountryID == address.CountryID); this.CardNumberField.Text = cardinfo.CardNumber; this.CountryField.Text = country.Name; this.CityField.Text = address.City; this.StreetField.Text = address.Street; }
public IActionResult Index(int?doctorId, string prefixString, string subString, bool sortOnClientNumber, bool sortOnFirstName) { /* Prefix: (sortOnClientNumber != null XOR sortOnFirstName != null) * XOR * (prefixString != null XOR subString != null) */ var result = new ClientListViewModel { ClientVMList = new List <ClientViewModel>() }; List <Client> cltList; //----Determine list of Clients --------------------------------------- if (!doctorId.HasValue) // Admin vraagt lijst op van alle clienten { cltList = _clientManager.SelectAllClientsAdmin(out int nrOfClients); } else // Doctor vraagt lijst op van zijn eigen clienten { result.DoctorId = doctorId.Value; result.DoctorFullName = _clientManager.DoctorFullName(doctorId.Value); cltList = _clientManager.SelectAllClientsPerDoctor((int)doctorId, out int nrOfClients); } var countryList = _countryManager.GetAllCountries(); // Copy clientList to clientListViewModel. for (int i = 0; i < cltList.Count; i++) { // Map Client naar ClientVM via extension method: var c1 = cltList[i]; var c2 = cltList[i].ToClientVM(); // Vul de basisvelden van c2 // Voeg afgeleide velden toe aan c2 c2.AgeInDays = (int)(DateTime.Today.Subtract(c1.BirthDate)).TotalDays; c2.ClientFullName = c1.FirstName + " " + c1.LastName; c2.NrofPrescriptions = _clientManager.GetNrOfPrescrPerClient(c1.Id); c2.DoctorFullName = _clientManager.DoctorFullName(c1.DoctorId); // Voeg alle landen toe aan de individuele client c2.Countries = countryList; result.ClientVMList.Add(c2); } ; // Als de buttons sortOnClientNumber of sortOnFirstName zijn geklikt, hebben deze voorrang // Negeer de teksten in prefixString en subString if (sortOnClientNumber || sortOnFirstName) { prefixString = null; subString = null; } // Als prefixString is ingevuld: Toon dan alle clienten wiens voornaam begint met deze prefix // Als subString is ingevuld: Toon dan alle clienten met deze substring ergens in voor-achternaam, of zelfs // de substring in de concat voornaam-achternaam // sorteer result.ClientVMList op ClientFullName if (prefixString == null && subString == null) { if (sortOnFirstName) { result.ClientVMList = result .ClientVMList .OrderBy(c => c.ClientFullName) .ToList(); } if (sortOnClientNumber) { result.ClientVMList = result .ClientVMList .OrderBy(c => c.Client.ClientNumber) .ToList(); } } else if (subString != null) { result.ClientVMList = result .ClientVMList. Where(c => c.Client.FirstName.ToLower() .Contains(subString.ToLower()) || c.Client.LastName.ToLower() .Contains(subString.ToLower()) ) .OrderBy(c => c.ClientFullName) .ToList(); } else if (prefixString != null) { result.ClientVMList = result .ClientVMList. Where(c => c.Client.FirstName.ToLower() .StartsWith(prefixString.ToLower()) || c.Client.LastName.ToLower() .StartsWith(prefixString.ToLower()) ) .OrderBy(c => c.ClientFullName) .ToList(); } if (subString != null) { _logger.LogDebug($"DEBUG INFO VAN JPVA - De lijst van clienten is opgevraagd " + $"met substring \"{subString}\" "); _logger.LogDebug($"DEBUG INFO VAN JPVA - Er werden {result.ClientVMList.Count} cliënten getoond"); _logger.LogInformation($"INFORMATION INFO VAN JPVA - De lijst van clienten is opgevraagd " + $"met substring \"{subString}\" "); _logger.LogInformation($"INFORMATION INFO VAN JPVA - Er werden {result.ClientVMList.Count} cliënten getoond"); //------------------------------------------ _logger.LogWarning($"WARNING INFO VAN JPVA - De lijst van clienten is opgevraagd " + $"met substring \"{subString}\" "); _logger.LogWarning($"WARNING INFO VAN JPVA - Er werden {result.ClientVMList.Count} cliënten getoond"); _logger.LogError($"ERROR INFO VAN JPVA - De lijst van clienten is opgevraagd " + $"met substring \"{subString}\" "); _logger.LogError($"ERROR INFO VAN JPVA - Er werden {result.ClientVMList.Count} cliënten getoond"); } result.PrefixString = null; result.SubString = null; // ModelState.Clear: // Anders worden de input teksten (prefix en substring) niet geschoond // Bij redisplay ModelState.Clear(); return(View(result)); }