This repository has been archived by the owner on Nov 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom route handling with MapUmbracoRoute and UmbracoVirtualNodeByIdHandler
- Loading branch information
Showing
10 changed files
with
150 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
C:\Users\mantu\AppData\Local\Temp\Temporary ASP.NET Files\vs\027ab051\822a0174\App_Web_all.generated.cs.8f9494c4.cnvmy50x.dll | ||
C:\Users\mantu\AppData\Local\Temp\Temporary ASP.NET Files\vs\027ab051\822a0174\App_Web_all.generated.cs.8f9494c4.oibqrept.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
d75e4cafcf09787f | ||
e4d2aa0bdb7a3315 |
Binary file not shown.
36 changes: 36 additions & 0 deletions
36
src/UmbracoUrlHandling/Controller/ProductDetailsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Web.Mvc; | ||
using Umbraco.Web.Models; | ||
using Umbraco.Web.Mvc; | ||
|
||
namespace UmbracoUrlHandling.Controller | ||
{ | ||
/// <summary> | ||
/// Controller for Product page | ||
/// </summary> | ||
/// <seealso cref="Umbraco.Web.Mvc.RenderMvcController" /> | ||
public class ProductDetailsController : RenderMvcController | ||
{ | ||
/// <summary> | ||
/// The default action to render the front-end view | ||
/// </summary> | ||
/// <param name="model"></param> | ||
/// <returns></returns> | ||
[NonAction] | ||
public override ActionResult Index(RenderModel model) | ||
{ | ||
return base.Index(model); | ||
} | ||
|
||
/// <summary> | ||
/// Indexes the specified model. | ||
/// </summary> | ||
/// <param name="model">The model.</param> | ||
/// <param name="sku">The sku.</param> | ||
/// <returns></returns> | ||
public ActionResult ProductDetails(RenderModel model, string sku) | ||
{ | ||
ViewData["sku"] = sku; | ||
return View("ProductDetails", model); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/UmbracoUrlHandling/RouteHandler/ProductRouteHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Umbraco.Web.Mvc; | ||
|
||
namespace UmbracoUrlHandling.RouteHandler | ||
{ | ||
/// <summary> | ||
/// Product Route Handler for Product Page | ||
/// </summary> | ||
/// <seealso cref="Umbraco.Web.Mvc.UmbracoVirtualNodeByIdRouteHandler" /> | ||
public class ProductRouteHandler : UmbracoVirtualNodeByIdRouteHandler | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ProductRouteHandler"/> class. | ||
/// </summary> | ||
/// <param name="realNodeId">The real node identifier.</param> | ||
public ProductRouteHandler(int realNodeId) : base(realNodeId) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.ProductDetails> | ||
@using ContentModels = Umbraco.Web.PublishedContentModels; | ||
@{ | ||
Layout = "Master.cshtml"; | ||
} | ||
|
||
<h1>The sku is: @ViewData["sku"]</h1> |