// GET: MyTeam public ActionResult Index() { MyTeamModel model = new MyTeamModel(); model.LoadAllTeams(); model.LoadMyTeams(LoggedInUser); model.FillOtherTeams(); return(View(model)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sportID = Request.QueryString["SportID"]; MyTeamModel toupdate = new MyTeamModel(); TeamServiceClient tsc = new TeamServiceClient(); toupdate = tsc.getTeamsDetails(sportID); txtName.Value = toupdate.TeamName; txtDesc.Value = toupdate.Desc; txtNumPlayer.Text = Convert.ToString(toupdate.NumPlayers); txtCategory.Value = toupdate.Type; } //getTeamsDetails }
protected void Page_Load(object sender, EventArgs e) { string sportID = Request.QueryString["SportID"]; MyTeamModel toupdate = new MyTeamModel(); TeamServiceClient tsc = new TeamServiceClient(); toupdate = tsc.getTeamsDetails(sportID); string htmltag = ""; htmltag += "<img src='" + toupdate.ImagePath + "' alt='...' />"; imgDiv.InnerHtml = htmltag; htmltag = ""; htmltag += toupdate.TeamName; Name.InnerHtml = htmltag; Desc.InnerHtml = toupdate.Desc; }
//find team details public MyTeamModel getTeamsDetails(string ID) { string json = null; MyTeamModel data = null; try { WebClient webClient = new WebClient(); json = webClient.DownloadString(URL + "getTeamsDetails/" + ID); data = JsonConvert.DeserializeObject <MyTeamModel>(json); return(data); } catch { return(null); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string gameID = Request.QueryString["G_ID"]; TeamServiceClient tsc = new TeamServiceClient(); List <MyTeamModel> teams = new List <MyTeamModel>(); teams = tsc.getTeamsByGameID(gameID); if (teams.Count() != 0 || teams == null) { MyTeamModel team1 = teams.First(); MyTeamModel team2 = teams.Last(); string html = ""; html += "<img src=" + team1.ImagePath + " class='avatar' alt='Avatar'/>"; tmOneImage.InnerHtml = html; html = ""; T1.InnerHtml = team1.TeamOne; T2.InnerHtml = team2.TeamTwo; tmTwoImage.InnerHtml = "<img src=" + team2.ImagePath + " class='avatar' alt='Avatar'/>"; } } //getTeamsByGameID }
protected void Page_Load(object sender, EventArgs e) { int GameID = Convert.ToInt32(Request.QueryString["G_ID"]); MatchServiceClient msc = new MatchServiceClient(); TeamServiceClient tsc = new TeamServiceClient(); Team gm = new Team(); gm = msc.GetGameByID(Convert.ToString(GameID)); List <MyTeamModel> teams = tsc.getTeamsByGameID(Convert.ToString(GameID)); //Team tm = teams.First(); //Team tm2 = teams.Last(); try { if (teams != null || teams.Count() != 0) { MyTeamModel t1 = teams.First(); MyTeamModel t2 = teams.Last(); if (t1 != null || t2 != null) { List <Player> T1players = t1.players; List <Player> T2players = t2.players; if (T1players != null || T2players != null) { string html = ""; html += "<img style='width: 100%; display: block;' src='" + t1.ImagePath + "' alt='image'/>"; img1Div.InnerHtml = html; html = ""; html += "<b>" + t1.TeamName + "</b>"; T1Name.InnerHtml = html; T1_Desc.InnerHtml = t1.Desc; T2_Desc.InnerHtml = t2.Desc; html = ""; html += "<img style='width: 100%; display: block;' src='" + t2.ImagePath + "' alt='image'/>"; img2Div.InnerHtml = html; html = ""; html += "<b>" + t2.TeamName + "</b>"; t2Name.InnerHtml = html; html = ""; html += gm.sDate + " : " + gm.Venue; Venue_Time.InnerHtml = html; html = ""; if (T1players != null || T2players != null) { foreach (Player pl in T1players) { html += "<tr>"; html += "<th scope='row'>" + pl.Position + "</th>"; html += "<td>" + pl.Name + "</td>"; html += "<td>" + pl.PerformanceRate + "</td></tr>"; } player1.InnerHtml = html; html = ""; foreach (Player pl in T2players) { html += "<tr>"; html += "<th scope='row'>" + pl.Position + "</th>"; html += "<td>" + pl.Name + "</td>"; html += "<td>" + pl.PerformanceRate + "</td></tr>"; } player2.InnerHtml = html; } } } } } catch (Exception) { //DO Something } // MyTeamModel t1 = teams.ElementAt(0); // MyTeamModel t2 = teams.ElementAt(1); }