public void Configure(IAppRouteConfig appRouteConfig)
        {
            appRouteConfig.AddAnonymousPath("/");

            appRouteConfig.AddAnonymousPath("/Users/register");

            appRouteConfig.AddAnonymousPath("/Users/login");

            appRouteConfig.Get(
                "/",
                req => new HomeController().Index(req));

            appRouteConfig.Get(
                "/Users/login",
                req => new AccountController().Login(req.Session));

            appRouteConfig.Post(
                "/Users/login",
                req => new AccountController().Login(req.Session, req.FormData));

            appRouteConfig.Get(
                "/Users/register",
                req => new AccountController().Register(req.Session));

            appRouteConfig.Post(
                "/Users/register",
                req => new AccountController().Register(req.Session, req.FormData));

            appRouteConfig.Get(
                "/Users/logout",
                req => new AccountController().Logout(req.Session));

            appRouteConfig.Get(
                "/Albums/create",
                req => new AlbumController().Create(req.Session));

            appRouteConfig.Post(
                "/Albums/create",
                req => new AlbumController().Create(req.FormData));

            appRouteConfig.Get(
                "/Albums/all",
                req => new AlbumController().All(req.Session));

            appRouteConfig.Get(
                "/Albums/details?albumId={(?<albumId>[A-Za-z0-9-]+)}",
                req => new AlbumController().Details(req.Session, req.UrlParameters["albumId"]));

            appRouteConfig.Get(
                "/Tracks/create?albumId={(?<albumId>.+)}",
                req => new TrackController().Create(req.UrlParameters));

            appRouteConfig.Post(
                "/Tracks/create?albumId={(?<albumId>.+)}",
                req => new TrackController().Create(req));

            appRouteConfig.Get(
                "/Tracks/details?albumId={(?<albumId>[A-Za-z0-9-]+)}&trackId={(?<trackId>[A-Za-z0-9-]+)}}",
                req => new TrackController().Details(req));
        }
Ejemplo n.º 2
0
        public void Configure(IAppRouteConfig appRouteConfig)
        {
            appRouteConfig
            .AddAnonymousPath("/");

            appRouteConfig
            .AddAnonymousPath("/login");

            appRouteConfig
            .AddAnonymousPath("/register");

            appRouteConfig
            .AddAnonymousPath("/successfulReg");

            appRouteConfig.Get("/", req => new HomeController().Index(req));

            appRouteConfig
            .Get(
                "/about",
                req => new HomeController().About(req)
                );

            appRouteConfig
            .Get(
                "/add",
                req => new ProductController().Add(req)
                );

            appRouteConfig
            .Post(
                "/add",
                req => new ProductController()
                .Add(
                    req.FormData["name"],
                    req.FormData["price"],
                    req.FormData["url"],
                    req.Session.Get <ProfileViewModel>(SessionStore.CurrentUserKey).Name
                    ));

            appRouteConfig.Get("/search", req => new ProductController().Search(req));

            appRouteConfig.Get("/login", req => new AccountController().Login(req));

            appRouteConfig.Post("/login", req => new AccountController().Login(req, new LoginUserViewModel()
            {
                Username = req.FormData["username"],
                Password = req.FormData["password"]
            }
                                                                               ));

            appRouteConfig
            .Get(
                "/shopping/add/{(?<id>[0-9]+)}",
                req => new ShoppingController().AddToOrder(req)
                );

            appRouteConfig
            .Get(
                "/product/details/{(?<id>[0-9]+)}",
                req => new ProductController().Details(req)
                );

            appRouteConfig
            .Get(
                "/product/partOfOrderDetails/{(?<id>[0-9]+)}",
                req => new ProductController().OrderProductDetails(req)
                );

            appRouteConfig.Get("/order", req => new ShoppingController().ShowCurrentOrder(req));

            appRouteConfig.Get("/order/{(?<id>[0-9]+)}", req => new ShoppingController().ShowCompleteOrder(req));

            appRouteConfig.Get("/success", req => new ShoppingController().Success(req));

            appRouteConfig.Get("/logout", req => new AccountController().Logout(req));

            appRouteConfig.Get("/register", req => new AccountController().Register());

            appRouteConfig
            .Post(
                "/register",
                req => new AccountController().Register(new RegisterUserViewModel()
            {
                Username        = req.FormData["username"],
                Password        = req.FormData["password"],
                ConfirmPassword = req.FormData["passwordConfirmed"]
            }));

            appRouteConfig.Get("/profile", req => new AccountController().ProfileView(req));

            appRouteConfig.Get("/myOrders", req => new AccountController().OrdersView(req));
        }
Ejemplo n.º 3
0
        public void Configure(IAppRouteConfig appRouteConfig)
        {
            appRouteConfig.AddAnonymousPath("/");

            appRouteConfig.AddAnonymousPath("/login");

            appRouteConfig.AddAnonymousPath("/register");


            appRouteConfig.Get(
                "/login",
                req => new AccountController().Login(req.Session)
                );

            appRouteConfig.Post(
                "/login",
                req => new AccountController().Login(req.Session, req.FormData)
                );

            appRouteConfig.Get(
                "/",
                req => new HomeController().Index(req)
                );

            appRouteConfig.Get(
                "/register",
                req => new AccountController().Register(req.Session)
                );

            appRouteConfig.Post(
                "/register",
                req => new AccountController().Register(req.FormData)
                );

            appRouteConfig.Get(
                "/logout",
                req => new AccountController().Logout(req)
                );

            appRouteConfig.Get(
                "/admin-games",
                req => new GameController().AdminGames(req.Session)
                );

            appRouteConfig.Get(
                "/add-game",
                req => new GameController().AddGame(req.Session)
                );

            appRouteConfig.Post(
                "/add-game",
                req => new GameController().AddGame(req)
                );

            appRouteConfig.Get(
                "/edit-game/{(?<id>[0-9]+)}",
                req => new GameController().EditGame(req.Session, req.UrlParameters["id"])
                );

            appRouteConfig.Post(
                "/edit-game/{(?<id>[0-9]+)}",
                req => new GameController().EditGame(req.FormData, req.UrlParameters)
                );

            appRouteConfig.Get(
                "/delete-game/{(?<id>[0-9]+)}",
                req => new GameController().DeleteGame(req.Session, req.UrlParameters["id"])
                );

            appRouteConfig.Post(
                "/delete-game/{(?<id>[0-9]+)}",
                req => new GameController().DeleteGame(req.FormData, req.UrlParameters)
                );

            appRouteConfig.Get(
                "/game-details/{(?<id>[0-9]+)}",
                req => new GameController().Details(req)
                );

            appRouteConfig.Get(
                "/buy-game/{(?<id>[0-9]+)}",
                req => new CartController().Buy(req)
                );

            appRouteConfig.Get(
                "/cart",
                req => new CartController().ShowGames(req)
                );
        }