ASP.net MVC calling a view from different controllers

I have EmployeeControllerand ShiftController. In IndexView, EmployeeControllerI show EmployeeDetailswith the parameters Edit, Deleteand GetShifts(this gets all the shifts of this employee - EmpShifts.aspx). In EmpShifts.aspx I want to give a link to Create New Shift. I want to know how to call a Createshift view from EmpShifts.aspx.

Do I have the wrong design structure. Suggestions are welcome.

+3
source share
1 answer

When creating links, you can specify the action and controller to which they point:

<%= Html.ActionLink("Create new shift", "create", "shift") %>

The same goes for HTML forms that allow POST:

<% using (Html.BeginForm("create", "shift")) <% { %>
    ...
<% } %>

. , , .

+2

All Articles