public static async Task <long> GetIdByEmailAndTextAsync(this AppealRepository repos, string email, string text) { var entities = await repos.GetEntities(); return(entities.FirstOrDefault(p => p.Email.Equals(email) && p.Text.Equals(text)).Key); }
public static async Task <IEnumerable <Appeal> > GetEntitiesByEmail(this AppealRepository repository, string email) { if (string.IsNullOrEmpty(email)) { throw new ArgumentException($"Error receiving appeals email = {email}"); } var appeals = await repository.GetEntities(); return(appeals.Where(p => p.Email.Equals(email))); }
public async void GetAllAppealTest() { var appeal = new Appeal() { Email = "*****@*****.**" }; var appeal1 = new Appeal() { Email = "*****@*****.**" }; var repos = new AppealRepository(new AppDbContext()); repos.Add(appeal); repos.Add(appeal1); var appeals = await repos.GetEntities(); Assert.IsTrue(appeals.ToList().Count() > 0); repos.Delete(appeal); repos.Delete(appeal1); }