コード例 #1
0
 public User FindUserByZipcode(string zipcode)
 {
     //BEGIN_CHALLENGE
     using (var context = new ChallengeContext())
         return context.Users.FirstOrDefault(x => x.Information.ZipCode == zipcode);
     //END_CHALLENGE
     throw new NotImplementedException();
 }
コード例 #2
0
 public int CountUsers(string filter)
 {
     //BEGIN_CHALLENGE
     using (var context = new ChallengeContext())
         return context.Users
             .ToArray() // For some reason the EF connector ends up using CHARINDEX, which SQLite does not support
             .Count(x => x.Name.Contains(filter) || x.Email.Contains(filter));
     //END_CHALLENGE
     throw new NotImplementedException();
 }
コード例 #3
0
 public User[] ListParticipantsByCreatorFirstname(string name)
 {
     //BEGIN_CHALLENGE
     using (var context = new ChallengeContext())
         return context.Challenges
             .Where(c => c.Creator.Information.FirstName.Equals(name))
             .SelectMany(c => c.Participants.Select(p => p.User))
             .ToArray();
     //END_CHALLENGE
     throw new NotImplementedException();
 }