Esempio n. 1
0
 public async Task UpdateAsync(TClass item)
 {
     using (SoccerIdDbContext context = new SoccerIdDbContext())
     {
         context.Entry(context.Set <TClass>()).State = EntityState.Modified;
         await context.SaveChangesAsync();
     }
 }
Esempio n. 2
0
 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();
     }
 }
Esempio n. 3
0
 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();
     }
 }
Esempio n. 4
0
 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();
     }
 }
Esempio n. 5
0
 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();
     }
 }
Esempio n. 6
0
 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();
     }
 }
Esempio n. 7
0
        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);
        }