コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public void Save()
 {
     context.SaveChanges();
 }