I have an EmployeeController
and ShiftController
. In the Index
View of EmployeeController
I show EmployeeDetails
with options of Edit
, Delete
and GetShifts
(this gets all the shifts of that employee - EmpShifts.aspx). In EmpShifts.aspx, I want to give a link to Create New Shift
. I want to know how to call Create
View of Shifts from EmpShifts.aspx
.
Am I having the wrong design structure. Suggestions on that are welcome.
When generating links you can specify the action and controller they are pointing to:
<%= Html.ActionLink("Create new shift", "create", "shift") %>
Same for HTML forms allowing you to POST:
<% using (Html.BeginForm("create", "shift")) <% { %>
...
<% } %>
Your design is correct. It is perfectly normal for having links/forms in some view pointing to other controller actions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.