public List <TimeEntry> List() { using (var db = new IzoneContext()) { return(db.TimeEntries.Take(10).ToList()); } }
double ITimeEntryRepository.TotalHours() { using (var db = new IzoneContext()) { return(db.TimeEntries.Sum(x => x.Hours)); } }
public List <Person> List() { using (var db = new IzoneContext()) { return(db.People.ToList()); } }
public Person GetBySlackUsername(string slackUsername) { using (var db = new IzoneContext()) { return(db.People.Where(x => x.SlackUsername == slackUsername).FirstOrDefault()); } }
public void SetSlackId(Person person) { using (var db = new IzoneContext()) { var dbPerson = db.People.Where(x => x.SlackUsername == person.SlackUsername).FirstOrDefault(); if (dbPerson == null) { throw new Exception(string.Format("Cannot find Person having slack username '{0}'", person.SlackUsername)); } dbPerson.SlackId = person.SlackId; db.Update(dbPerson); db.SaveChanges(); } }