public static async Task CreateLocation(Location location) { using (AwesomeContext context = new AwesomeContext()) { context.Locations.Add(location); await context.SaveChangesAsync(); } }
public static async Task CreateParticipant(Participant participant) { using (AwesomeContext context = new AwesomeContext()) { context.Participants.Add(participant); await context.SaveChangesAsync(); } }
public static async Task CreateMeeting(Meeting meeting) { using (AwesomeContext awesomeContext = new AwesomeContext()) { awesomeContext.Meetings.Add(meeting); await awesomeContext.SaveChangesAsync(); } }
/// <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(); } }
/// <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(); } }
/// <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(); } }
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(); } }