public bool DeleteTeam(Guid TeamID) { Team Team = context.Teams.Find(TeamID); var entity = context.Users.Where(user => user.teamid == TeamID); if (Team != null) { foreach (var user in entity) { user.teamid = null; user.Team = null; context.Entry(user).State = EntityState.Modified; } context.SaveChanges(); context.Teams.Remove(Team); return(true); } else { return(false); } }
public void UpdatePost(Post Post) { context.Entry(Post).State = EntityState.Modified; }
public void UpdateEvent(Event Event) { context.Entry(Event).State = EntityState.Modified; }
public void UpdateUser(User User) { context.Entry(User).State = EntityState.Modified; }