This is a migrated thread and some comments may be shown as answers.

[Solved] Duplicated actions

1 Answer 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
paulo larini
Top achievements
Rank 1
paulo larini asked on 06 Jul 2011, 10:09 PM
Hi, currently I have to write 2 actions to send me the same result:
one for my form post
other for grid ajax bind.

look:

public ActionResult Pesquisar(PrestadorFiltro filtro = null)
       {
           if (Session["token"] == null)
               return RedirectToAction("Index", "Home");
 
           if (filtro == null)
               filtro = new PrestadorFiltro { Nome = null, Estado = null };
 
           DataSet prestadores = consultaPrestador.PesquisarPrestadorFiltroCompleto(
               Session["token"].ToString(), filtro.Estado, filtro.Municipio != null ? Int32.Parse(filtro.Municipio) : 0, 0, 0, 0, filtro.Nome, null, 0, 0, null);
 
           Session["ultimoFiltro"] = filtro;
 
           return PartialView("_GridPesquisa", prestadores.Tables.Count > 0 ? prestadores.Tables[0] : null);
       }
 
       [GridAction]
       public ActionResult AjaxPesquisar()
       {
           PrestadorFiltro ultimoFiltro = Session["ultimoFiltro"] as PrestadorFiltro;
           DataSet prestadores = consultaPrestador.PesquisarPrestadorFiltroCompleto(
               Session["token"].ToString(), ultimoFiltro.Estado, ultimoFiltro.Municipio != null ? Int32.Parse(ultimoFiltro.Municipio) : 0, 0, 0, 0, ultimoFiltro.Nome, null, 0, 0, null);
 
           return View(new GridModel(prestadores.Tables.Count > 0 ? prestadores.Tables[0] : null));
       }


There is a way to know if the action is called from one or from other ?

Thanks.

1 Answer, 1 is accepted

Sort by
0
paulo larini
Top achievements
Rank 1
answered on 18 Jul 2011, 04:03 PM
Any help ?
Tags
Grid
Asked by
paulo larini
Top achievements
Rank 1
Answers by
paulo larini
Top achievements
Rank 1
Share this question
or