Actionresult Asp.net MVC methods

Asked

Viewed 111 times

1

If I create a method like ActionResult with any name and give a re-turn to a View that I want to return something, will work normally or need to have the same name of View ?

public ActionResult RetornarIRPJ(string Tipo)
{
       BoletoRepositorio br = new BoletoRepositorio();
       BoletoModel bm = new BoletoModel();

          bm.IRPJ = br.IRPJ(Tipo).ToString();

          return View("Detalhes");
}

1 answer

2


Yes, it will work, just you pass correctly in the name of the view:

public ActionResult GoToView()  
{
    return View("frmProdutos");
}
  • I created a method here, and in the end I’m returning it to view but it doesn’t fall even at the breakpoint. Strange.

  • @Andreeh I haven’t touched the SP net mvc for a while, but edit and post the methods for redirecting the view that we take a look at.

  • Ready @Thiago Falcão

  • heim @Andreeh, tries to put the [Httppost] on top of the Actionresult method and tries to debug

  • in that case is Get what I intend to do.

  • 1

    But does the Details view take ??? Type "Details/1" ?? If so, do Return View("Details", new { id=youUbject.Id });

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.