Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult MyFavorites()
        {
            if (string.IsNullOrEmpty(this.AppUserState.UserId))
            {
                List <CodeSnippetListItem> snippetListEmpty = new List <CodeSnippetListItem>();
                this.ViewData["SnippetList"] = snippetListEmpty;
                this.ErrorDisplay.ShowError("You have to log in to see your favorites.");
                return(View());
            }

            using (busCodeSnippet busSnippet = new busCodeSnippet())
            {
                this.ViewData["busSnippet"] = busSnippet;
                var snippetList = busSnippet.GetFavorites(this.AppUserState.UserId);
                this.ViewData["SnippetList"] = snippetList;
                this.ViewData["PageTitle"]   = "My Favorites";
                ActionResult actionResult = this.ApiResult(snippetList);
                if (actionResult != null)
                {
                    return(actionResult);
                }
            }

            return(View());
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public ActionResult MyFavorites()
        {
            if (string.IsNullOrEmpty(this.AppUserState.UserId))
            {
                List<CodeSnippetListItem> snippetListEmpty = new List<CodeSnippetListItem>();
                this.ViewData["SnippetList"] = snippetListEmpty;
                this.ErrorDisplay.ShowError("You have to log in to see your favorites.");
                return View();
            }

            using (busCodeSnippet busSnippet = new busCodeSnippet())
            {
                this.ViewData["busSnippet"] = busSnippet;
                var snippetList = busSnippet.GetFavorites(this.AppUserState.UserId);
                this.ViewData["SnippetList"] = snippetList;
                this.ViewData["PageTitle"] = "My Favorites";
                ActionResult actionResult = this.ApiResult(snippetList);
                if (actionResult != null)
                    return actionResult;
            }

            return View();
        }