Exemplo n.º 1
0
 public List <TimeEntry> List()
 {
     using (var db = new IzoneContext())
     {
         return(db.TimeEntries.Take(10).ToList());
     }
 }
Exemplo n.º 2
0
 double ITimeEntryRepository.TotalHours()
 {
     using (var db = new IzoneContext())
     {
         return(db.TimeEntries.Sum(x => x.Hours));
     }
 }
Exemplo n.º 3
0
 public List <Person> List()
 {
     using (var db = new IzoneContext())
     {
         return(db.People.ToList());
     }
 }
Exemplo n.º 4
0
 public Person GetBySlackUsername(string slackUsername)
 {
     using (var db = new IzoneContext())
     {
         return(db.People.Where(x => x.SlackUsername == slackUsername).FirstOrDefault());
     }
 }
Exemplo n.º 5
0
        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();
            }
        }