예제 #1
0
        public ActionResult FilterContributorStories(string selectedGenre, string selectedType)
        {
            BrowseStoryModel model = new BrowseStoryModel();

            storiesAvailable = new List <StoryModel>();
            var username = Session["username"].ToString();

            storiesAvailable  = new GetStories().getContributorStories(username);
            model.Stories     = HomeControllerUtilities.FilterStories(storiesAvailable, selectedGenre, selectedType);;
            model.GenreValues = HomeControllerUtilities.GetGenres();
            model.TypeValues  = HomeControllerUtilities.GetTypes();

            return(View("BrowseStories", model));
        }
예제 #2
0
        public ActionResult FilterStories(string selectedGenre, string selectedType, string filter, string filterbykey, BrowseStoryModel key, int?storyID)
        {
            BrowseStoryModel model = new BrowseStoryModel();

            if (storyID == null)
            {
                if (!string.IsNullOrEmpty(filter))
                {
                    storiesAvailable = new List <StoryModel>();
                    storiesAvailable = new GetStories().GetAllStories();
                    model.Stories    = HomeControllerUtilities.FilterStories(storiesAvailable, selectedGenre, selectedType);

                    model.GenreValues = HomeControllerUtilities.GetGenres();
                    model.TypeValues  = HomeControllerUtilities.GetTypes();
                }
                if (!string.IsNullOrEmpty(filterbykey))
                {
                    storiesAvailable = new List <StoryModel>();

                    storiesAvailable  = new GetStories().GetAllStories();
                    model.Stories     = HomeControllerUtilities.FilterStoriesbySearchKey(storiesAvailable, key.SearchKey);
                    model.GenreValues = HomeControllerUtilities.GetGenres();
                    model.TypeValues  = HomeControllerUtilities.GetTypes();
                }
                return(View("BrowseStories", model));
            }
            if (Session["username"] == null)
            {
                Session["StoryID"]        = storyID;
                Session["StoryIDViewBag"] = storyID;
                return(RedirectToAction("Login", "Account"));
            }
            Session["StoryID"] = storyID;  //GetStoryBased on the story ID
            ContributeStoryModel storyDetails = HomeControllerUtilities.GetContributeStoryData(Convert.ToInt32(storyID));

            return(View("ContributeToStory", storyDetails));
        }