public Task DeleteAsync(Session session) { var foundSession = _context.Sessions.Find(session.Id); if (foundSession != null) { _context.Sessions.Remove(foundSession); _context.SaveChanges(); } return Task.FromResult(0); }
public Task UpdateAsync(Session session) { var foundSession = _context.Sessions.Find(session.Id); if (foundSession != null) { foundSession.Id = session.Id; foundSession.MapId = session.MapId; foundSession.ModeId = session.ModeId; foundSession.Started = session.Started; foundSession.Finished = session.Finished; _context.SaveChanges(); } return Task.FromResult(0); }
public Task CreateAsync(Session session) { var newSession = new Model.Session { Id = session.Id, MapId = session.MapId, ModeId = session.ModeId, Started = session.Started, Finished = session.Finished }; _context.Sessions.Add(newSession); _context.SaveChanges(); session.Id = newSession.Id; return Task.FromResult(0); }