public async Task UpdateAsync(TClass item) { using (SoccerIdDbContext context = new SoccerIdDbContext()) { context.Entry(context.Set <TClass>()).State = EntityState.Modified; await context.SaveChangesAsync(); } }
public override async Task RemoveAsync(int id) { using (SoccerIdDbContext context = new SoccerIdDbContext()) { var photo = context.Set <Photo>().FirstOrDefault(t => t.Id == id); context.Entry(photo).State = System.Data.Entity.EntityState.Deleted; await context.SaveChangesAsync(); } }
public override async Task RemoveAsync(int id) { using (SoccerIdDbContext context = new SoccerIdDbContext()) { var eventPlace = context.EventPlaces.FirstOrDefault(t => t.Id == id); context.Entry(eventPlace).State = System.Data.Entity.EntityState.Deleted; await context.SaveChangesAsync(); } }
public async Task RemoveAsync(int teamId, int userId) { using (SoccerIdDbContext context = new SoccerIdDbContext()) { var userArchTeam = context.UsersArchiveTeams.FirstOrDefault(t => t.ArchiveTeam_Id == teamId && t.User_Id == userId); context.Entry(userArchTeam).State = System.Data.Entity.EntityState.Deleted; await context.SaveChangesAsync(); } }
public override async Task RemoveAsync(int id) { using (SoccerIdDbContext context = new SoccerIdDbContext()) { var agreedPlayersList = context.AgreedPlayersLists.FirstOrDefault(t => t.Id == id); context.Entry(agreedPlayersList).State = System.Data.Entity.EntityState.Deleted; await context.SaveChangesAsync(); } }
public override async Task RemoveAsync(int id) { using (SoccerIdDbContext context = new SoccerIdDbContext()) { var playingPosition = context.PlayingPositions.FirstOrDefault(t => t.Id == id); context.Entry(playingPosition).State = System.Data.Entity.EntityState.Deleted; await context.SaveChangesAsync(); } }
public async Task <TClass> AddAsync(TClass item) { TClass result = null; using (SoccerIdDbContext context = new SoccerIdDbContext()) { result = context.Set <TClass>().Add(item); await context.SaveChangesAsync(); } return(result); }