protected void SbmBtn_Click(object sender, EventArgs e) { CrusadersService.GameResult res = new CrusadersService.GameResult(); res.Comp = TxtComp.Text; res.Data = TxtData.Text; res.Opponent = TxtOpnt.Text; res.Venue = TxtVenue.Text; res.Points = TxtPnt.Text; res.Result = ChkWin.Checked; db.AddToGameResults(res); db.SaveChanges(); setCreatedMessage(); Response.Redirect("Show.aspx"); }
protected void Page_Load(object sender, EventArgs e) { db = Global.CrusadersEntitiesDB(); string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { if (!IsPostBack) { res = db.GameResults.Where(x => x.id == int.Parse(id)).Single(); TxtData.Text = res.Data; TxtOpnt.Text = res.Opponent; TxtVenue.Text = res.Venue; TxtComp.Text = res.Comp; TxtPnt.Text = res.Points; ChkWin.Checked = res.Result; } } else { Response.Redirect("Show.aspx"); } }