Exercise Files
This commit is contained in:
23
Ch05/05_02_Begin/Website/Extensions/HtmlHelperExtensions.cs
Normal file
23
Ch05/05_02_Begin/Website/Extensions/HtmlHelperExtensions.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc.Html;
|
||||
|
||||
namespace HPlusSports
|
||||
{
|
||||
public static class HtmlHelperExtensions
|
||||
{
|
||||
|
||||
public static IHtmlString Rating(this System.Web.Mvc.HtmlHelper html, Models.ProductRating rating)
|
||||
{
|
||||
if (rating == null || rating.ReviewCount == 0)
|
||||
{
|
||||
return new System.Web.Mvc.MvcHtmlString("<span><em>No Rating</em></span>");
|
||||
}
|
||||
|
||||
return html.Partial("_Rating", rating);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user