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(); } }
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(); } }