Beispiel #1
0
 public void Update(TClass item)
 {
     using (SoccerIdDbContext context = new SoccerIdDbContext())
     {
         context.Entry(item).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Beispiel #2
0
 public override void Remove(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;
         context.SaveChanges();
     }
 }
Beispiel #3
0
 public override void Remove(int id)
 {
     using (SoccerIdDbContext context = new SoccerIdDbContext())
     {
         var league = context.Leagues.FirstOrDefault(t => t.Id == id);
         context.Entry(league).State = System.Data.Entity.EntityState.Deleted;
         context.SaveChanges();
     }
 }
 public void Remove(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;
         context.SaveChanges();
     }
 }
Beispiel #5
0
 public override void Remove(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;
         context.SaveChanges();
     }
 }
 public override void Remove(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;
         context.SaveChanges();
     }
 }
Beispiel #7
0
        public TClass Add(TClass item)
        {
            TClass result = null;

            using (SoccerIdDbContext context = new SoccerIdDbContext())
            {
                result = context.Set <TClass>().Add(item);
                context.SaveChanges();
            }
            return(result);
        }