Example #1
0
        public BaseModule()
            : base()
        {
            Before += ctx =>
            {
                AuthenticationRequest authRequest = new AuthenticationRequest(ctx);
                return authRequest.DoRequest();
            };

            Get[Constants.URL.Home] = _ =>
            {
                //Exception e = Utilities.GetException(Context);
                //if (e != null)
                //{
                //    return View["Error", e];
                //}

                return View["Home"];
            };

            Get["/callback"] = _ =>
            {
                //Exception e = Utilities.GetException(Context);
                //if (e != null)
                //{
                //    return View["Error", e];
                //}

                //return new RedirectResponse(Constants.URL.Home);
                return View["Home"];
            };
        }
        public BookmarkModule()
            : base(Constants.URL.BookmarkHome)
        {
            Before += ctx =>
            {
                AuthenticationRequest authRequest = new AuthenticationRequest(ctx);
                return authRequest.DoRequest();
            };

            Get["/"] = parameters =>
            {
                return "Hello Bookmark World!";
            };

            Post["/"] = parameters =>
            {
                return "Updated with checkmarked bookmarks removed!";
            };
        }
        public RecommendationsModule()
            : base(Constants.URL.Recommend)
        {
            Before += ctx =>
            {
                AuthenticationRequest authRequest = new AuthenticationRequest(ctx);
                return authRequest.DoRequest();
            };

            Get["/"] = parameters =>
            {
                return "Hello Recommendations World!";
            };

            Post["/"] = parameters =>
            {
                // TODO: If checkboxes checked, redirect to bkmrk home with message "added x bkmrks!", otherwise, error message at the top with no other changes
                // Redirect to the Bookmarks page after saving new bookmarks.
                return new RedirectResponse(Constants.URL.BookmarkHome);
            };
        }