Пример #1
0
 public ActionResult Index(string criterio)
 {
     if (criterio == null || criterio == "")
     {
         return(View(persona.Listar()));
     }
     else
     {
         return(View(persona.Buscar(criterio)));
     }
 }
        // GET: Persona
        public ActionResult Index(string criterio)
        {
            if (criterio == null || criterio == "")
            {
                //Persona p = new Persona();
                //ViewBag.Persona = p.Listar();

                return(View(persona.Listar()));
            }
            else
            {
                return(View(persona.Buscar(criterio)));
            }
        }
 public ActionResult Buscar(string criterio)
 {
     return(View(
                criterio == null || criterio == "" ? persona.Listar()
       : persona.Buscar(criterio)
                ));
 }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //ActivarBotones(false);
            TelefonoTexBox.MaxLength = 15;
            DataTable dt      = new DataTable();
            Persona   persona = new Persona();

            if (!IsPostBack)
            {
                if (Request.QueryString["ID"] != null)
                {
                    int id = Convert.ToInt32(Request.QueryString["ID"].ToString());
                    if (persona.Buscar(id))
                    {
                        DevolverDatos(persona);
                        NombreTextBox.Focus();
                    }
                    else
                    {
                        Utils.MensajeToastr(this, "" + PersonaIdTextBox.Text + " no Existe", "Error", "Warning");
                    }
                }

                dt.Columns.AddRange(new DataColumn[2] {
                    new DataColumn("Tipo"), new DataColumn("Numero")
                });
                ViewState["Persona"] = dt;
            }
        }