134e697777f8b4eb7df48c4ee69ddd8d67079f46
Guides/MVC-Integration/Phase-II-Draft.md
| ... | ... | @@ -22,14 +22,42 @@ Delete UserController.cs, UserModels.cs, and the whole User folder under Views a |
| 22 | 22 | |
| 23 | 23 | ### Step 3. Add Link to Izenda |
| 24 | 24 | |
| 25 | +Since the link to Izenda will be visible only to logged in users, cut the actionlink we made in step 12 of Phase I and paste it in _LoginPartial.cshtml, which contains conditional statements on login. |
|
| 26 | + |
|
| 25 | 27 | **a.** Open _Layout.cshtml in Views\Shared\ in Solution Explorer |
| 26 | 28 | |
| 27 | 29 | **b.** Cut the ActionLink which leads to Izenda as below |
| 28 | 30 | |
| 29 | -**c.** Open _LoginPartial.cshtml in Views\Shared\ in Solution Explorer |
|
| 31 | +```html |
|
| 32 | +<li>@Html.ActionLink("Home", "Index", "Home")</li> |
|
| 33 | +<li>@Html.ActionLink("About", "About", "Home")</li> |
|
| 34 | +<li>@Html.ActionLink("Contact", "Contact", "Home")</li> |
|
| 35 | + <li>@Html.ActionLink("Izenda", "ReportList", "Reporting")</li> //Cut this line |
|
| 36 | +``` |
|
| 30 | 37 | |
| 31 | -**d.** Paste the ActionLink in IF block as below so that Izenda link is visible only after logging in |
|
| 38 | +**c.** Open _LoginPartial.cshtml in Views\Shared\ in Solution Explorer |
|
| 32 | 39 | |
| 40 | +**d.** Paste the ActionLink in IF block as below so that link to Izenda is visible only after logging in |
|
| 41 | + |
|
| 42 | +```html |
|
| 43 | +<li>@Html.ActionLink("Home", "Index", "Home")</li> |
|
| 44 | +<li>@Html.ActionLink("About", "About", "Home")</li> |
|
| 45 | +<li>@Html.ActionLink("Contact", "Contact", "Home")</li> |
|
| 46 | + <li>@Html.ActionLink("Izenda", "ReportList", "Reporting")</li> //Cut this line |
|
| 47 | +``` |
|
| 48 | +@if (Request.IsAuthenticated) { |
|
| 49 | + |
|
| 50 | + <text> |
|
| 51 | + Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" }) |
|
| 52 | + @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) { |
|
| 53 | + @Html.AntiForgeryToken() |
|
| 54 | + <a href="javascript:document.getElementById('logoutForm').submit()">Log off</a> |
|
| 55 | + |
|
| 56 | + <li>@Html.ActionLink("Izenda", "ReportList", "Reporting")</li> // Paste the action link here |
|
| 57 | + |
|
| 58 | + } |
|
| 59 | + </text> |
|
| 60 | +} |
|
| 33 | 61 | |
| 34 | 62 | |
| 35 | 63 | ### Step 4. Add Login User Model |