Call by menu does not enter Action

0

I have this menu in _Layout.cshtml

 @if (Response.Cookies["UserSession"]["UserRole"] == "Rh" || Response.Cookies["UserSession"]["UserRole"] == "Admin")
                        {
                            <li>
                                <a href="#"><i class="fa fa-bar-chart-o"></i> RH - Relatórios<span class="fa arrow"></span></a>
                                <ul class="nav nav-second-level">
                                    <li>
                                            @Html.ActionLink("Financiamento de veículos", "ExcelFinancing", "FinancingReport")
                                        </li>
                                </ul>
                            </li>
                        }

The problem is that when calling this menu item, it should stop on the break within Action in the controller. This is Action on the controller controller

[HttpGet]
public ActionResult ExcelFinancing(DateTime dateFinancing)
{
     var t = 1 * 9;//Teste apenas, break aqui
     return null;
}

What happens is that when I click on this menu item, it gives me the error of type 500, internal server error. How do I get into the controller by calling the Menu?

NOTE: I have another view called View.cshtml that inherits from _Layout.cshtml and I have other functions. Should I do something from it? Or would the call only in _Layout.cshtml suffice?

    
asked by anonymous 16.09.2018 / 16:01

1 answer

1

Your action has a DateTime dateFinancing parameter, but in your ActionLink you are not passing this parameter.

Or remove the action parameter, or try something like this on your link:

@Html.ActionLink("Financiamento de veículos", "ExcelFinancing", "FinancingReport", new { dateFinancing = null })

Being that you should replace the null of the parameter with the date you want to pass by parameter.

    
17.09.2018 / 00:11