예제 #1
0
 public void Add(MOE.Common.Models.Phase phase)
 {
     MOE.Common.Models.Phase g = (from r in db.Phases
                                  where r.PhaseID == phase.PhaseID
                                  select r).FirstOrDefault();
     if (g == null)
     {
         db.Phases.Add(g);
         db.SaveChanges();
     }
 }
예제 #2
0
 public void Update(MOE.Common.Models.Phase phase)
 {
     MOE.Common.Models.Phase g = (from r in db.Phases
                                  where r.PhaseID == phase.PhaseID
                                  select r).FirstOrDefault();
     if (g != null)
     {
         db.Entry(g).CurrentValues.SetValues(phase);
         db.SaveChanges();
     }
     else
     {
         db.Phases.Add(phase);
         db.SaveChanges();
     }
 }