コード例 #1
0
        public void DropTeamRoster(TeamRosterEntry teamMember)
        {
            TeamRosterEntry temp = context.TeamRosterEntries.FirstOrDefault(u => (u.UserID == teamMember.UserID) && (u.TeamID == teamMember.TeamID));

            context.TeamRosterEntries.Remove(temp);
            context.SaveChanges();
        }
コード例 #2
0
        public void AddTeamRoster(int uid, int tid)
        {
            var newTeamMember = new TeamRosterEntry { UserID = uid, TeamID = tid };

            context.TeamRosterEntries.Add(newTeamMember);
            context.SaveChanges();
        }
コード例 #3
0
        public ActionResult AddNewTeamMemberByID(int id)
        {
            int tid = (int)Session["TeamID"];

            var uid = id;

            // avoid duplicate entries
            TeamRosterEntry temp = new TeamRosterEntry { UserID = uid, TeamID = tid };
            if (repository.TestTeamRoster(temp) == null)
                repository.AddTeamRoster(uid, tid);
            TempData["message"] = string.Format("User {0} has been added to team {1}.", temp.UserID, temp.TeamID);
            return RedirectToAction("AddTeamMember/" + tid.ToString());
        }
コード例 #4
0
        public ActionResult DropTeamMember(int id)
        {
            int tid = (int)Session["TeamID"];

            int userID = id;

            TeamRosterEntry temp = new TeamRosterEntry { UserID = userID, TeamID = tid };
            repository.DropTeamRoster(temp);
            repository.SaveChanges();
            TempData["message"] = string.Format("User {0} has been dropped from team {1}.", temp.UserID, temp.TeamID);
            return RedirectToAction("AddTeamMember/" + tid.ToString());
        }
コード例 #5
0
 //returns null if the person is not on the team, skillset, or minor.
 public TeamRosterEntry TestTeamRoster(TeamRosterEntry teamMember)
 {
     TeamRosterEntry temp = context.TeamRosterEntries.FirstOrDefault(u => (u.UserID == teamMember.UserID) && (u.TeamID == teamMember.TeamID));
     return temp;
 }
コード例 #6
0
        public void AddTeamRoster(int uid, int tid)
        {
            var newTeamMember = new TeamRosterEntry { UserID = uid, TeamID = tid };

            if (GetUser(uid) != null)//make sure the id number given is a real id number before continuing
            {
                context.TeamRosterEntries.Add(newTeamMember);
                context.SaveChanges();
            }
        }