Example #1
0
 public async Task <Person> GetPeopleByName(string name)
 => (await Person.GetDataAsync().ConfigureAwait(false)).FirstOrDefault(x => x.Name == name)
 ?? throw HttpException.NotFound();
Example #2
0
 public async Task <Person> GetPeople(int id)
 => (await Person.GetDataAsync().ConfigureAwait(false)).FirstOrDefault(x => x.Id == id)
 ?? throw HttpException.NotFound();
Example #3
0
 public Person GetPerson(string skill, int age)
 => PeopleRepository.Database.FirstOrDefault(p => string.Equals(p.MainSkill, skill, StringComparison.CurrentCultureIgnoreCase) && p.Age == age)
 ?? throw HttpException.NotFound();
Example #4
0
 private static Person CheckPerson(int id)
 => PeopleRepository.Database.FirstOrDefault(p => p.Key == id)
 ?? throw HttpException.NotFound();
Example #5
0
 public Person GetPerson(DateTime date)
 => PeopleRepository.Database.FirstOrDefault(p => p.DoB == date)
 ?? throw HttpException.NotFound();