Пример #1
0
        //Get post by post urlslug
        public ViewResult Post(string urlslug)
        {
            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " :: Post - Begin");
            Post post = null;

            try
            {
                post = dataaccess.Post(urlslug, null);
                post.PostNavDetails = dataaccess.GetNextAndPreviousPostIds(post.PostId);
                User objuser = dataaccess.GetUserList().Where(x => x.UserId.Equals(post.UserId)).FirstOrDefault();
                ViewBag.AuthorName = objuser.FirstName + " " + objuser.LastName;
                if (post == null)
                {
                    throw new HttpException(404, "Post Not Found");
                }
                else if (post.IsPublished == false && User.Identity.IsAuthenticated == false)
                {
                    throw new HttpException(401, "Post Not Published");
                }
            }
            catch (Exception ex)
            {
                logginghelper.Log(LoggingLevels.Error, "Class: " + classname + " :: Post " + ex);
            }
            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " :: Post - End");
            return(View(post));
        }
Пример #2
0
        public ViewResult NotifyPostToSubscribers(long postId, string postUrlSlug)
        {
            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " ::  NotifyPostToSubscribers - Begin");
            Post objPost = new Post();

            try
            {
                objPost = dataaccess.Post(postUrlSlug, postId);
            }
            catch (Exception ex)
            {
                logginghelper.Log(LoggingLevels.Error, "Class: " + classname + " ::  NotifyPostToSubscribers" + ex);
            }
            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " ::  NotifyPostToSubscribers - End");
            return(View(objPost));
        }
Пример #3
0
        public ViewResult Post(string urlslug)
        {
            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " :: Post - Begin");
            Post post = null;

            try
            {
                post = dataaccess.Post(urlslug);
                if (post != null)
                {
                    throw new HttpException(404, "Post Not Found");
                }
                else if (post.IsPublished == false && User.Identity.IsAuthenticated == false)
                {
                    throw new HttpException(401, "Post Not Published");
                }
            }
            catch (Exception ex)
            {
                logginghelper.Log(LoggingLevels.Error, "Class: " + classname + " :: Post " + ex);
            }
            logginghelper.Log(LoggingLevels.Info, "Class: " + classname + " :: Post - End");
            return(View(post));
        }