Exemplo n.º 1
0
        public string[] CommentDetails(CommentWall comment)
        {
            string[] commentDetails = new string[13];

            commentDetails[0] = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(comment.UserName);//username
            var pathToFile = "/Content/images/profile/" + commentDetails[0] + "/" + commentDetails[0] + ".png";

            if (!System.IO.File.Exists(System.Web.Hosting.HostingEnvironment.MapPath(pathToFile)))
            {
                pathToFile = "/Content/images/profile/Default.png";
            }
            commentDetails[1]  = pathToFile + "?time=" + DateTime.Now.ToString();
            commentDetails[2]  = TimePassed(comment.DateTime);                                                                  //passed time
            commentDetails[3]  = comment.DateTime.ToLongDateString().Replace(comment.DateTime.DayOfWeek.ToString() + ", ", ""); //comment date
            commentDetails[4]  = "parComment" + comment.Id;                                                                     //grandparentid
            commentDetails[5]  = "mComment" + comment.Id;                                                                       //maincommentId
            commentDetails[6]  = "comReplies" + comment.Id;                                                                     //repliesId
            commentDetails[7]  = "comtExpress" + comment.Id;                                                                    //commentExpid
            commentDetails[8]  = "ctrlExpand" + comment.Id;                                                                     //ctrlExpId
            commentDetails[9]  = "comtText" + comment.Id;                                                                       //comText
            commentDetails[10] = "commTextArea" + comment.Id;                                                                   //comTextdiv
            commentDetails[11] = "comReply" + comment.Id;                                                                       //Reply
            commentDetails[12] = "commentCtrl" + comment.Id;                                                                    //commentControl

            return(commentDetails);
        }
Exemplo n.º 2
0
        public List <CommentWallViewModel> GetProfileParentReplies(CommentWall commentWall)
        {
            var parentReplies = _context.CommentWallReplies.Where(p => p.CommentId == commentWall.Id && p.ParentReplyId == null).ToList();
            List <CommentWallViewModel> parReplies = new List <CommentWallViewModel>();

            foreach (var par in parentReplies)
            {
                var chReplies = GetProfileChildReplies(par);
                parReplies.Add(new CommentWallViewModel()
                {
                    Body = par.Body, ParentReplyId = par.ParentReplyId, DateTime = par.DateTime, Id = par.Id, UserName = par.UserName, WallChildReplies = chReplies
                });
            }
            return(parReplies);
        }
Exemplo n.º 3
0
        public ActionResult NewComment(string commentBody, string profileUrl, string profUserName, string comUserName)
        {
            var profileId   = _profileFunctions.GetUserIdByUserName(profUserName);
            var commentWall = new CommentWall()
            {
                ProfileId = profileId,
                DateTime  = DateTime.Now,
                UserName  = comUserName,
                Body      = commentBody,
            };

            _profileFunctions.AddNewWallComment(commentWall);
            //return RedirectToAction("FullProfile", new { slug = slug });
            return(RedirectToAction(profileUrl));
        }
Exemplo n.º 4
0
 public void AddNewWallComment(CommentWall commentWall)
 {
     _context.CommenstWall.Add(commentWall);
     Save();
 }