Exemplo n.º 1
0
 private static Schedule[] CreateSchedules()
 {
     var newSchedules = new Schedule[10];
     for (int i = 0; i < newSchedules.Length; ++i)
     {
         var schedule = new Schedule {Id = i};
         newSchedules[i] = schedule;
     }
     return newSchedules;
 }
Exemplo n.º 2
0
 public void UpdateSchedule(Schedule schedule)
 {
     using (var context = new DatabaseContext())
     {
         var entity = context.Schedules.FirstOrDefault(item => item.Id == schedule.Id);
         entity.User1Id = schedule.First == null ? (Guid?) null : schedule.First.Id;
         entity.User2Id = schedule.Second == null ? (Guid?) null : schedule.Second.Id;
         entity.User3Id = schedule.Third == null ? (Guid?) null : schedule.Third.Id;
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 private static void SaveNewSchedules(Schedule[] newSchedules, DatabaseContext context)
 {
     foreach (var schedule in newSchedules)
     {
         var scheduleEntity = new ScheduleEntity {Id = schedule.Id};
         context.Schedules.Add(scheduleEntity);
     }
     context.SaveChanges();
 }