| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.Linq;
|
|---|
| 4 | using System.Web;
|
|---|
| 5 | using System.Web.Mvc;
|
|---|
| 6 | using System.Web.Routing;
|
|---|
| 7 |
|
|---|
| 8 | namespace Wyceny
|
|---|
| 9 | {
|
|---|
| 10 | // Note: For instructions on enabling IIS6 or IIS7 classic mode,
|
|---|
| 11 | // visit http://go.microsoft.com/?LinkId=9394801
|
|---|
| 12 |
|
|---|
| 13 | public class MvcApplication : System.Web.HttpApplication
|
|---|
| 14 | {
|
|---|
| 15 | public static void RegisterRoutes(RouteCollection routes)
|
|---|
| 16 | {
|
|---|
| 17 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
|---|
| 18 |
|
|---|
| 19 | // Report/Authors/2009/7
|
|---|
| 20 | routes.MapRoute(
|
|---|
| 21 | "Authors", // Route name
|
|---|
| 22 | "Report/Authors/{year}/{month}", // URL with parameters
|
|---|
| 23 | new { controller = "Report", action = "Authors", year = DateTime.Now.Year, month = DateTime.Now.Month } // Parameter defaults
|
|---|
| 24 | );
|
|---|
| 25 |
|
|---|
| 26 | // Report/AuthorsByMagazines/2009/7/1
|
|---|
| 27 | routes.MapRoute(
|
|---|
| 28 | "AuthorsByMagazinesByEmployment", // Route name
|
|---|
| 29 | "Report/AuthorsByMagazinesByEmployment/{year}/{month}/{employment}", // URL with parameters
|
|---|
| 30 | new { controller = "Report", action = "AuthorsByMagazinesByEmployment", year = DateTime.Now.Year, month = DateTime.Now.Month } // Parameter defaults
|
|---|
| 31 | );
|
|---|
| 32 |
|
|---|
| 33 | // Report/AuthorsByMagazines/2009/7
|
|---|
| 34 | routes.MapRoute(
|
|---|
| 35 | "AuthorsByMagazines", // Route name
|
|---|
| 36 | "Report/AuthorsByMagazines/{year}/{month}", // URL with parameters
|
|---|
| 37 | new { controller = "Report", action = "AuthorsByMagazines", year = DateTime.Now.Year, month = DateTime.Now.Month } // Parameter defaults
|
|---|
| 38 | );
|
|---|
| 39 |
|
|---|
| 40 | routes.MapRoute(
|
|---|
| 41 | "AuthorCard", // Route name
|
|---|
| 42 | "Report/AuthorCard/{year}/{month}/{author}", // URL with parameters
|
|---|
| 43 | new { controller = "Report", action = "AuthorCard", year = DateTime.Now.Year, month = DateTime.Now.Month, author = 0 } // Parameter defaults
|
|---|
| 44 | );
|
|---|
| 45 |
|
|---|
| 46 | routes.MapRoute(
|
|---|
| 47 | "All", // Route name
|
|---|
| 48 | "Report/All/{year}/{month}/{user}", // URL with parameters
|
|---|
| 49 | new { controller = "Report", action = "All", year = DateTime.Now.Year, month = DateTime.Now.Month, user = 0 } // Parameter defaults
|
|---|
| 50 | );
|
|---|
| 51 |
|
|---|
| 52 | routes.MapRoute(
|
|---|
| 53 | "Default", // Route name
|
|---|
| 54 | "{controller}/{action}/{id}", // URL with parameters
|
|---|
| 55 | new { controller = "Home", action = "Index", id = "" } // Parameter defaults
|
|---|
| 56 | );
|
|---|
| 57 |
|
|---|
| 58 | }
|
|---|
| 59 |
|
|---|
| 60 | protected void Application_Start()
|
|---|
| 61 | {
|
|---|
| 62 | RegisterRoutes(RouteTable.Routes);
|
|---|
| 63 | }
|
|---|
| 64 | }
|
|---|
| 65 | } |
|---|