protected void Page_Load(object sender, EventArgs e) { UserControlShackTags.TargetControlID = TextBoxBio.ClientID; if (!IsPostBack) { using (SBEntities db = new SBEntities()) { UserSession uc = Helper.GetUserSession(); User u = db.GetUser(uc.userKey); TextBoxGamerTag.Text = u.GamerTag; TextBoxPSN.Text = u.PSNID; TextBoxNintendo.Text = u.NintendoAccount; TextBoxBattleNet.Text = u.BattleNet; TextBoxSteam.Text = u.SteamAccount; TextBoxOrigin.Text = u.OriginAccount; TextBoxBio.Text = u.Bio; var userBattles = (from b in db.Battles where b.CreatorKey == uc.userKey select new { b.Title, b.BattleGUID, b.BattleDate }).Take(10).ToList(); RepeaterPreviousBattles.DataSource = userBattles; RepeaterPreviousBattles.DataBind(); } } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { using (SBEntities db = new SBEntities()) { UserSession uc = Helper.GetUserSession(); User u = db.GetUser(uc.userKey); u.GamerTag = TextBoxGamerTag.Text.Trim(); u.PSNID = TextBoxPSN.Text.Trim(); u.NintendoAccount = TextBoxNintendo.Text.Trim(); u.BattleNet = TextBoxBattleNet.Text.Trim(); u.SteamAccount = TextBoxSteam.Text.Trim(); u.OriginAccount = TextBoxOrigin.Text.Trim(); u.Bio = TextBoxBio.Text.Trim(); db.SaveChanges(); } }
protected void Page_Load(object sender, EventArgs e) { using (SBEntities db = new SBEntities()) { int userKey = int.Parse(Page.RouteData.Values["UserKey"].ToString()); User u = db.GetUser(userKey); LiteralShackName.Text = u.Username; LiteralProfileName.Text = u.Username; LiteralMemberSince.Text = u.DateCreated.ToShortDateString(); LiteralGamerTag.Text = u.GamerTag; LiteralPSNID.Text = u.PSNID; LiteralNintendoID.Text = u.NintendoAccount; LiteralBattleNet.Text = u.BattleNet; LiteralSteam.Text = u.SteamAccount; LiteralOrigin.Text = u.OriginAccount; LabelBio.Text = u.Bio; } }