public async Task <IActionResult> Domains() { if (_loadedDomains != null) { return(Ok(_loadedDomains)); } var response = new BasePostResponse <ContactEventDomains>(); ContactEventDomains record = new ContactEventDomains(); var taskGetServices = _domainRepository.Services(); var taskGetServiceTypes = _domainRepository.ServiceTypes(); var taskList = new List <Task>() { taskGetServices, taskGetServiceTypes }; await Task.WhenAll(taskList.ToArray()); record.ServiceCodes = taskGetServices.Result.Select(x => new SelectItem() { Id = x.Id, Code = x.Code.ToString(), ShortDescription = x.Description }).ToList(); record.ServiceTypes = taskGetServiceTypes.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.Abbreviation, LongDescription = x.Name }).ToList(); // _loadedDomains = record; response.Data = record; return(Ok(response)); }
public BasePostResponse FirstPost([FromBody] string value) { (bool isFine, string msg) = First.CheckResult(value); var response = new BasePostResponse { IsFine = isFine, Message = msg }; return(response); }
public async Task <IActionResult> Domains() { if (_loadedDomains != null) { return(Ok(_loadedDomains)); } var response = new BasePostResponse <ConstituentDomains>(); ConstituentDomains record = new ConstituentDomains(); var taskGetCities = _domainRepository.Cities(); var taskGetContactTypes = _domainRepository.ContactTypes(); var taskPostal = _domainRepository.PostalCodes(); var taskState = _domainRepository.States(); var taskGetSuffix = _domainRepository.Suffixes(); var taskGetTitles = _domainRepository.Titles(); var taskTownships = _domainRepository.Townships(); var taskEthnicities = _domainRepository.Ethnicities(); var taskGenders = _domainRepository.Genders(); var taskIncomeLevels = _domainRepository.IncomeLevels(); var taskLanguages = _domainRepository.Languages(); var taskMaritalStatuses = _domainRepository.MaritalStatuses(); var taskRaces = _domainRepository.Races(); var taskList = new List <Task>() { taskGetCities, taskGetContactTypes, taskPostal, taskState, taskGetTitles, taskGetSuffix, taskTownships, taskEthnicities, taskGenders, taskIncomeLevels, taskLanguages, taskMaritalStatuses, taskRaces }; await Task.WhenAll(taskList.ToArray()); record.Cities = taskGetCities.Result.Select(x => new SelectItem() { Id = x.CityId, ShortDescription = x.CityName }).ToList(); record.Suffixes = taskGetSuffix.Result.Select(x => new SelectItem() { Id = x.SuffixId, ShortDescription = x.SuffixText }).ToList(); record.Titles = taskGetTitles.Result.Select(x => new SelectItem() { Id = x.TitleId, ShortDescription = x.TitleText }).ToList(); record.ContactTypes = taskGetContactTypes.Result; record.PostalCodes = taskPostal.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.Code }).ToList(); record.States = taskState.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.StateCd }).ToList(); record.Townships = taskTownships.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.TownshipName }).ToList(); record.Ethnicities = taskEthnicities.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.Description }).ToList(); record.Genders = taskGenders.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.Description }).ToList(); record.IncomeLevels = taskIncomeLevels.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.Description }).ToList(); record.Languages = taskLanguages.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.CodeText }).ToList(); record.MaritalStatuses = taskMaritalStatuses.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.MaritalType }).ToList(); record.Races = taskRaces.Result.Select(x => new SelectItem() { Id = x.Id, ShortDescription = x.Type }).ToList(); _loadedDomains = record; response.Data = record; return(Ok(response)); }