Html.ActionLink helper available.

Enabling music store code to use the Html.ActionLink helper.
This commit is contained in:
Praburaj 2014-04-09 12:04:53 -07:00
parent 8610e016b3
commit 0f25f9ff6b
11 changed files with 56 additions and 67 deletions

View File

@ -1,32 +1,32 @@
{ {
"version": "0.1-alpha-*", "version": "0.1-alpha-*",
"dependencies": { "dependencies": {
"Helios": "0.1-alpha-226", "Helios": "0.1-alpha-231",
"Microsoft.AspNet.Abstractions": "0.1-alpha-233", "Microsoft.AspNet.Abstractions": "0.1-alpha-234",
"Microsoft.AspNet.Mvc": "0.1-alpha-544", "Microsoft.AspNet.Mvc": "0.1-alpha-553",
"Microsoft.AspNet.Razor": "0.1-alpha-181", "Microsoft.AspNet.Razor": "0.1-alpha-181",
"Microsoft.AspNet.ConfigurationModel": "0.1-alpha-172", "Microsoft.AspNet.ConfigurationModel": "0.1-alpha-174",
"Microsoft.AspNet.DependencyInjection": "0.1-alpha-240", "Microsoft.AspNet.DependencyInjection": "0.1-alpha-242",
"Microsoft.AspNet.RequestContainer": "0.1-alpha-231", "Microsoft.AspNet.RequestContainer": "0.1-alpha-234",
"Microsoft.AspNet.Routing": "0.1-alpha-212", "Microsoft.AspNet.Routing": "0.1-alpha-214",
"Microsoft.AspNet.Mvc.ModelBinding": "0.1-alpha-544", "Microsoft.AspNet.Mvc.ModelBinding": "0.1-alpha-553",
"Microsoft.AspNet.Mvc.Core": "0.1-alpha-544", "Microsoft.AspNet.Mvc.Core": "0.1-alpha-553",
"Microsoft.AspNet.Mvc.Razor": "0.1-alpha-544", "Microsoft.AspNet.Mvc.Razor": "0.1-alpha-553",
"Microsoft.AspNet.StaticFiles": "0.1-alpha-174", "Microsoft.AspNet.StaticFiles": "0.1-alpha-175",
"System.Security.Claims": "0.1-alpha-114", "System.Security.Claims": "0.1-alpha-115",
"System.Security.Principal": "4.0.0.0", "System.Security.Principal": "4.0.0.0",
"Microsoft.AspNet.Security.DataProtection": "0.1-alpha-142", "Microsoft.AspNet.Security.DataProtection": "0.1-alpha-142",
"Microsoft.AspNet.Identity": "0.1-alpha-308", "Microsoft.AspNet.Identity": "0.1-alpha-315",
"Microsoft.AspNet.Identity.Entity": "0.1-alpha-308", "Microsoft.AspNet.Identity.Entity": "0.1-alpha-315",
"Microsoft.AspNet.Identity.InMemory": "0.1-alpha-308", "Microsoft.AspNet.Identity.InMemory": "0.1-alpha-315",
"Microsoft.Data.Entity": "0.1-alpha-411", "Microsoft.Data.Entity": "0.1-alpha-416",
"Microsoft.Data.Relational": "0.1-alpha-411", "Microsoft.Data.Relational": "0.1-alpha-416",
"Microsoft.Data.SqlServer": "0.1-pre-411", "Microsoft.Data.SqlServer": "0.1-pre-416",
"Microsoft.Data.InMemory": "0.1-alpha-411", "Microsoft.Data.InMemory": "0.1-alpha-416",
"Microsoft.AspNet.Diagnostics": "0.1-alpha-116", "Microsoft.AspNet.Diagnostics": "0.1-alpha-119",
"Microsoft.AspNet.Hosting": "0.1-alpha-231", "Microsoft.AspNet.Hosting": "0.1-alpha-234",
"Microsoft.AspNet.Server.WebListener": "0.1-alpha-163", "Microsoft.AspNet.Server.WebListener": "0.1-alpha-168",
"Microsoft.AspNet.Configuration.Json": "0.1-alpha-172" "Microsoft.AspNet.Configuration.Json": "0.1-alpha-174"
}, },
"configurations": { "configurations": {
"net45": { "net45": {
@ -47,7 +47,10 @@
"System.Console": "4.0.0.0", "System.Console": "4.0.0.0",
"System.Diagnostics.Debug": "4.0.10.0", "System.Diagnostics.Debug": "4.0.10.0",
"System.Diagnostics.Tools": "4.0.0.0", "System.Diagnostics.Tools": "4.0.0.0",
"Microsoft.ComponentModel.DataAnnotations": "4.0.10.0" "Microsoft.ComponentModel.DataAnnotations": "4.0.10.0",
"System.Reflection": "4.0.10.0",
"System.Reflection.Extensions": "4.0.0.0",
"System.IO": "4.0.0.0"
} }
} }
} }

View File

@ -12,5 +12,5 @@
<p> <p>
How about shopping for some more music in our How about shopping for some more music in our
@*@Html.ActionLink("Store", "Index", "Home")*@ @Html.ActionLink("Store", "Index", "Home")
</p> </p>

View File

@ -5,21 +5,16 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
@foreach (var genre in Model) @foreach (var genre in Model)
{ {
@*<li> <li>
@Html.ActionLink(genre.Name, @Html.ActionLink(genre.Name,
"Browse", "Store", "Browse", "Store",
new { Genre = genre.Name }, null) new { Genre = genre.Name }, null)
</li>*@
<li>
<a href="@Url.Action("Browse", "Store", new { Genre = genre.Name })">@genre.Name</a>
</li> </li>
} }
<li class="divider"></li> <li class="divider"></li>
<li> <li>
@*@Html.ActionLink("More...", "Index", "Store")*@ @Html.ActionLink("More...", "Index", "Store")
<a href="@Url.Action("Index", "Store")">More...</a>
</li> </li>
</li> </li>
</ul> </ul>
</li> </li>

View File

@ -21,16 +21,14 @@
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
@*Bug: no Html helpers yet*@ @Html.ActionLink("ASP.NET MVC Music Store", "Index", "Home", null, new { @class = "navbar-brand" })
@*@Html.ActionLink("ASP.NET MVC Music Store", "Index", "Home", null, new { @class = "navbar-brand" })*@
<a class="navbar-brand" href="~/">ASP.NET MVC Music Store</a>
</div> </div>
@*Bug: HtmlHelpers missing*@
<div class="navbar-collapse collapse"> <div class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
@*<li>@Html.ActionLink("Home", "Index", "Home")</li>*@ <li>@Html.ActionLink("Home", "Index", "Home")</li>
@await Component.InvokeAsync("GenreMenu") @await Component.InvokeAsync("GenreMenu")
@* @Html.Action("CartSummary", "ShoppingCart")*@ @*Bug: HtmlHelper missing*@
@*@Html.Action("CartSummary", "ShoppingCart")*@
</ul> </ul>
@await Html.PartialAsync("_LoginPartial") @await Html.PartialAsync("_LoginPartial")
</div> </div>
@ -41,8 +39,7 @@
<hr /> <hr />
<footer class="navbar navbar-fixed-bottom navbar-default text-center"> <footer class="navbar navbar-fixed-bottom navbar-default text-center">
<p><a href="http://mvcmusicstore.codeplex.com">mvcmusicstore.codeplex.com</a></p> <p><a href="http://mvcmusicstore.codeplex.com">mvcmusicstore.codeplex.com</a></p>
@*Bug: No Html helpers yet*@ <small>@Html.ActionLink("admin", "Index", "StoreManager")</small>
@*<small>@Html.ActionLink("admin", "Index", "StoreManager")</small>*@
</footer> </footer>
</div> </div>

View File

@ -8,7 +8,7 @@
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
@*@Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Manage", "Account", routeValues: null, htmlAttributes: new { title = "Manage" })*@ @Html.ActionLink("Hello " + Context.HttpContext.User.Identity.Name + "!", "Manage", "Account", routeValues: null, htmlAttributes: new { title = "Manage" })
</li> </li>
<li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li> <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
</ul> </ul>
@ -17,9 +17,7 @@
else else
{ {
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
@*<li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li> <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
<li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>*@ <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
<li>Register</li>
<li>Log in</li>
</ul> </ul>
} }

View File

@ -41,7 +41,7 @@
<em>Review</em> your cart: <em>Review</em> your cart:
</h3> </h3>
<p class="button"> <p class="button">
@*@Html.ActionLink("Checkout >>", "AddressAndPayment", "Checkout")*@ @Html.ActionLink("Checkout >>", "AddressAndPayment", "Checkout")
</p> </p>
<div id="update-message"> <div id="update-message">
</div> </div>
@ -62,8 +62,8 @@
{ {
<tr id="row-@item.CartItemId"> <tr id="row-@item.CartItemId">
<td> <td>
@*@Html.ActionLink(item.Album.Title, @Html.ActionLink(item.Album.Title,
"Details", "Store", new { id = item.AlbumId }, null)*@ "Details", "Store", new { id = item.AlbumId }, null)
</td> </td>
<td> <td>
@item.Album.Price @item.Album.Price

View File

@ -26,8 +26,7 @@
@Html.ValueFor(model => model.Price) @Html.ValueFor(model => model.Price)
</p> </p>
<p class="button"> <p class="button">
@*Bug: HTML helpers not implemented yet*@ @Html.ActionLink("Add to cart", "AddToCart",
@*@Html.ActionLink("Add to cart", "AddToCart", "ShoppingCart", new { id = Model.AlbumId })
"ShoppingCart", new { id = Model.AlbumId }, "")*@
</p> </p>
</div> </div>

View File

@ -12,8 +12,6 @@
<ul class="list-group"> <ul class="list-group">
@foreach (var genre in Model) @foreach (var genre in Model)
{ {
//Bug: Html helpers ActionLink is not implemented still <li class="list-group-item">@Html.ActionLink(genre.Name, "Browse", new { genre = genre.Name })</li>
@*<li class="list-group-item">@Html.ActionLink(genre.Name, "Browse", new { genre = genre.Name })</li>*@
<li class="list-group-item"><a href="@Url.Action("Browse", "Store", new { genre = genre.Name })">@genre.Name</a></li>
} }
</ul> </ul>

View File

@ -54,8 +54,7 @@
</dl> </dl>
</div> </div>
@*Bug: Need HtmlHelpers*@ <p>
@*<p> @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumId }) |
@Html.ActionLink("Edit", "Edit", new { id = Model.AlbumId }) | @Html.ActionLink("Back to List", "Index")
@Html.ActionLink("Back to List", "Index") </p>
</p>*@

View File

@ -21,7 +21,7 @@
<h2>Index</h2> <h2>Index</h2>
<p> <p>
@*@Html.ActionLink("Create New", "Create")*@ @Html.ActionLink("Create New", "Create")
</p> </p>
<table class="table"> <table class="table">
@*Bug: Html.NameFor does not contain an overload taking in IEnumerable<Tmodel>*@ @*Bug: Html.NameFor does not contain an overload taking in IEnumerable<Tmodel>*@
@ -60,11 +60,11 @@
<td> <td>
@Html.ValueFor(modelItem => item.Price) @Html.ValueFor(modelItem => item.Price)
</td> </td>
@*<td> <td>
@Html.ActionLink("Edit", "Edit", new { id = item.AlbumId }) | @Html.ActionLink("Edit", "Edit", new { id = item.AlbumId }) |
@Html.ActionLink("Details", "Details", new { id = item.AlbumId }) | @Html.ActionLink("Details", "Details", new { id = item.AlbumId }) |
@Html.ActionLink("Delete", "Delete", new { id = item.AlbumId }) @Html.ActionLink("Delete", "Delete", new { id = item.AlbumId })
</td>*@ </td>
</tr> </tr>
} }

View File

@ -51,9 +51,9 @@
"System.Diagnostics.Debug": "4.0.10.0", "System.Diagnostics.Debug": "4.0.10.0",
"System.Diagnostics.Tools": "4.0.0.0", "System.Diagnostics.Tools": "4.0.0.0",
"Microsoft.ComponentModel.DataAnnotations": "4.0.10.0", "Microsoft.ComponentModel.DataAnnotations": "4.0.10.0",
"System.Reflection": "4.0.10.0", "System.Reflection": "4.0.10.0",
"System.Reflection.Extensions": "4.0.0.0", "System.Reflection.Extensions": "4.0.0.0",
"System.IO": "4.0.0.0" "System.IO": "4.0.0.0"
} }
} }
} }