Skip to content

Commit

Permalink
Added default controller to redirect all requests not intended for im…
Browse files Browse the repository at this point in the history
…age results to the default page
  • Loading branch information
ChrisAnn committed Apr 25, 2011
1 parent 687b223 commit bfa5b31
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
16 changes: 16 additions & 0 deletions Controllers/DefaultController.cs
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SevenDigital.WebGl.Controllers
{
public class DefaultController : Controller
{
public ActionResult Index()
{
return Redirect(Url.Content("~/index.html"));
}
}
}
6 changes: 6 additions & 0 deletions Global.asax.cs
Expand Up @@ -20,6 +20,12 @@ public static void RegisterRoutes(RouteCollection routes)

routes.MapRoute(
"Default", // Route name
"{controller}/{action}", // URL with parameters
new { controller = "Default", action = "Index" } // Parameter defaults
);

routes.MapRoute(
"Images", // Route name
"{controller}/{action}/{search}", // URL with parameters
new { controller = "Images", action = "Artist", search = "7515" } // Parameter defaults
);
Expand Down
1 change: 1 addition & 0 deletions SevenDigital.WebGl.csproj
Expand Up @@ -65,6 +65,7 @@
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\DefaultController.cs" />
<Compile Include="Models\ApiResponse.cs" />
<Compile Include="Controllers\ImagesController.cs" />
<Compile Include="Global.asax.cs">
Expand Down
4 changes: 2 additions & 2 deletions index.html
Expand Up @@ -52,8 +52,8 @@
}

var apiUrl = './images/'
+ getQuerystring("searchType", "artist")
+ "/" + getQuerystring("search");
+ getQuerystring("searchType", "artist")
+ "/" + getQuerystring("search", "7515");

var images = []
$.getJSON(apiUrl, function(data) {
Expand Down

0 comments on commit bfa5b31

Please sign in to comment.