public static PolicyLienholder Save(PolicyLienholder lienholder) { if (lienholder.ID == 0) { DbContextHelper.DbContext.Add(lienholder); } DbContextHelper.DbContext.SaveChanges(); return lienholder; }
public static void Delete(int id) { PolicyLienholder lienholder = new PolicyLienholder { ID = id }; DbContextHelper.DbContext.AttachTo("PolicyLienholders", lienholder); // Do the delete the category DbContextHelper.DbContext.DeleteObject(lienholder); // Apply the delete to the database DbContextHelper.DbContext.SaveChanges(); }