Beispiel #1
0
 public static async Task CreateLocation(Location location)
 {
     using (AwesomeContext context = new AwesomeContext())
     {
         context.Locations.Add(location);
         await context.SaveChangesAsync();
     }
 }
Beispiel #2
0
 public static async Task CreateParticipant(Participant participant)
 {
     using (AwesomeContext context = new AwesomeContext())
     {
         context.Participants.Add(participant);
         await context.SaveChangesAsync();
     }
 }
Beispiel #3
0
 public static async Task CreateMeeting(Meeting meeting)
 {
     using (AwesomeContext awesomeContext = new AwesomeContext())
     {
         awesomeContext.Meetings.Add(meeting);
         await awesomeContext.SaveChangesAsync();
     }
 }
Beispiel #4
0
 /// <summary>
 /// Update by overwriting everything
 /// </summary>
 /// <param name="newParticipant"></param>
 /// <returns></returns>
 public static async Task UpdateParticipant(Participant newParticipant)
 {
     using (AwesomeContext context = new AwesomeContext())
     {
         context.Participants.Attach(newParticipant);
         context.Entry(newParticipant).State = EntityState.Modified;
         await context.SaveChangesAsync();
     }
 }
Beispiel #5
0
 /// <summary>
 /// Update by overwriting everything
 /// </summary>
 /// <param name="newLocation"></param>
 /// <returns></returns>
 public static async Task UpdateLocation(Location newLocation)
 {
     using (AwesomeContext context = new AwesomeContext())
     {
         context.Locations.Attach(newLocation);
         context.Entry(newLocation).State = EntityState.Modified;
         await context.SaveChangesAsync();
     }
 }
Beispiel #6
0
 /// <summary>
 /// Update by overwriting everything
 /// </summary>
 /// <param name="meeting"></param>
 /// <returns></returns>
 public static async Task UpdateMeeting(Meeting meeting)
 {
     using (AwesomeContext context = new AwesomeContext())
     {
         context.Meetings.Attach(meeting);
         context.Entry(meeting).State = EntityState.Modified;
         await context.SaveChangesAsync();
     }
 }
Beispiel #7
0
 public static async Task AddParticipantToMeeting(Participant participant, Meeting meeting)
 {
     using (AwesomeContext context = new AwesomeContext())
     {
         context.Meetings.Attach(meeting);
         context.Participants.Attach(participant);
         meeting.Participants.Add(participant);
         await context.SaveChangesAsync();
     }
 }