public void SaveRecord(Record newRecord)
 {
     using (var dc = new EfRecordDbContext())
     {
         var entity = newRecord.ToEntity();
         dc.Records.Add(entity);
         dc.SaveChanges();
     }
 }
 public Record GetRecord(string phone)
 {
     using (var dc = new EfRecordDbContext())
     {
         var dbRecord = dc.Records.Single(entity => entity.Phone.Equals(phone, StringComparison.InvariantCultureIgnoreCase));
         var result = dbRecord.ToModel();
         return result;
     }
 }
 public IEnumerable<Record> GetRecords(string firstOrLastNameFragment)
 {
     firstOrLastNameFragment = firstOrLastNameFragment.ToLowerInvariant();
     using (var dc = new EfRecordDbContext())
     {
         var dbRecords = dc.Records
                     .Where(entity => entity.FirstName.Contains(firstOrLastNameFragment)
                                                 || entity.LastName.Contains(firstOrLastNameFragment))
                     .ToArray();
         var result = dbRecords.Select(entity => entity.ToModel());
         return result;
     }
 }