public IEnumerable <Person> ChangeAge_FilterPersonsMinAge(int change, int minAge) { IQueryable <Person> linq = from Person p in context.Persons where p.Age >= minAge select p; foreach (Person p in context.Persons) { p.Age = p.Age + change; context.SubmitChanges(); } return(linq.ToList()); }
/// <summary> /// Adds given Person entity to database context, and ultimately to database table. /// </summary> /// <param name="p">Person entity to add to database.</param> public void AddPerson(Person p) { context.Persons.InsertOnSubmit(p); context.SubmitChanges(); }