protected void SbmBtn_Click(object sender, EventArgs e) { CrusadersService.Ticket tic = new CrusadersService.Ticket(); tic.Type = TypeSlc.Value; tic.Price = TxtPrice.Text; tic.Description = TxtDesc.Text; tic.AgeOrType = AgeSlc.Value; db.AddToTickets(tic); db.SaveChanges(); setCreatedMessage(); Response.Redirect("Show.aspx"); }
protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) { if (!IsPostBack) { db = Global.CrusadersEntitiesDB(); ticket = db.Tickets.Where(x => x.id == int.Parse(id)).First(); TypeSlc.Value = ticket.Type; TxtPrice.Text = ticket.Price; TxtDesc.Text = ticket.Description; AgeSlc.Value = ticket.AgeOrType; } } else { Response.Redirect("Show.aspx"); } }