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(); }
public void AddTeamRoster(int uid, int tid) { var newTeamMember = new TeamRosterEntry { UserID = uid, TeamID = tid }; context.TeamRosterEntries.Add(newTeamMember); context.SaveChanges(); }
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()); }
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()); }
//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; }
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(); } }