// GET: Profile/ShowTeam public ActionResult ShowTeam() { if (string.IsNullOrEmpty(Request.QueryString["teamId"])) { return(Redirect("~/Profile/Index")); } int teamId; if (!int.TryParse(Request.QueryString["teamId"], out teamId)) { return(Redirect("~/Profile/Index")); } TeamHandle handle = UserManager.Default.QueryTeamById(teamId); if (handle == null) { return(Redirect("~/Error/TeamNotFound")); } TeamDetailModel model = TeamDetailModel.FromTeamHandle(handle); return(View(model)); }
public ActionResult UserTeams() { string username = Request.QueryString["username"]; if (string.IsNullOrEmpty(username)) { return(QueryResult(1, "Username is required.")); } if (!UserManager.Default.IsUserExist(username)) { return(QueryResult(2, "Username is not exist.")); } UserHandle user = new UserHandle(username); List <TeamDetailModel> teams = new List <TeamDetailModel>(); using (UserDataProvider userData = UserDataProvider.Create(user, true)) { foreach (TeamHandle team in userData.GetTeams()) { teams.Add(TeamDetailModel.FromTeamHandle(team)); } } return(QueryResult(teams)); }