protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int id; if (String.IsNullOrEmpty(Request.QueryString["uid"])) { Response.Redirect("frmListarCine.aspx"); } if (!int.TryParse(Request.QueryString["uid"], out id)) { Response.Redirect("frmListarCine.aspx"); } var CDAO = new CineDAO(); cine = CDAO.Obtener(id); if (cine != null) { this.txtNombre.Text = cine.Nombre; this.txtDireccion.Text = cine.Direccion; this.txtProvincia.Text = cine.Provincia; this.txtNroSalas.Text = cine.nroSalas + ""; this.txtAforo.Text = cine.Aforo + ""; } } }
public ActionResult Create(Sala sala, int combo) { Cine cine = cineDao.Obtener(combo); sala.cine = cine; salaDao.Crear(sala); return(RedirectToAction("Index")); }
protected void gvListado_RowCommand(object sender, GridViewCommandEventArgs e) { var CDAO = new CineDAO(); if (e.CommandName.Equals("Eliminar")) { int id = Convert.ToInt32(e.CommandArgument); CDAO.Eliminar(CDAO.Obtener(id)); CargarDatos(); } }
public ActionResult Edit(int?id) { if (id.HasValue) { var cine = cineDao.Obtener(id.Value); return(View(cine)); } else { return(RedirectToAction("Index")); } }