public bool InsertarAlmacen(tblAlmacen _TBL_Alm) { bool respuesta = false; try { contexto.tblAlmacen.InsertOnSubmit(_TBL_Alm); contexto.SubmitChanges(); respuesta = true; } catch (Exception ex) { System.Console.WriteLine(ex.ToString()); respuesta = false; } return(respuesta); }
protected void btnaceptar_Click(object sender, EventArgs e) { var encargado = ddlEncargado.SelectedItem.Value; tblAlmacen alm = new tblAlmacen(); alm.strNombre = txtNombre.Text.ToUpper(); alm.strDescripcion = txtDescrip.Text.ToUpper(); alm.intCapacidad = Int32.Parse(txtCapacidad.Text); alm.fkEncargado = Int32.Parse(encargado); alm.idActivo = 1; ControllerAlmacen ctrlAlm = new ControllerAlmacen(); ctrlAlm.InsertarAlmacen(alm); this.ClientScript.RegisterStartupScript(this.GetType(), "SweetAlert", "exito()", true); this.LimpiarCampos(); }