Exemplo n.º 1
0
 public void Update(Gig gig)
 {
     using (DbContext context = new DbContext())
     {
         context.Entry(gig).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Delete(int id)
 {
     using (DbContext context = new DbContext())
     {
         Gig gig = context.Gigs.FirstOrDefault(g => g.Id == id);
         context.Entry(gig).State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void Save(MusicalDirector director)
 {
     using (DbContext context = new DbContext())
     {
         if (context.MusicalDirectors.Any())
         {
             context.Entry(director).State = EntityState.Modified;
         }
         else
         {
             context.MusicalDirectors.Add(director);
         }
         context.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void Save(Band band)
 {
     using (DbContext context = new DbContext())
     {
         if (context.Bands.Any())
         {
             context.Entry(band).State = EntityState.Modified;
         }
         else
         {
             context.Bands.Add(band);
         }
         context.SaveChanges();
     }
 }