public ActionResult NewParentReply(string replyBody, int commentid, string ProfileUrl, string profUserName, string comUserName) { var profileId = _profileFunctions.GetUserIdByUserName(profUserName); var commentWallreply = new CommentWallReply() { CommentId = commentid, ProfileId = profileId, ParentReplyId = null, DateTime = DateTime.Now, UserName = comUserName, Body = replyBody, }; _profileFunctions.AddNewWallReply(commentWallreply); //return RedirectToAction("FullProfile", new { slug = slug }); return(RedirectToAction(ProfileUrl)); }
public List <CommentWallViewModel> GetProfileChildReplies(CommentWallReply parentReply) { List <CommentWallViewModel> chldReplies = new List <CommentWallViewModel>(); if (parentReply != null) { var childReplies = _context.CommentWallReplies.Where(p => p.ParentReplyId == parentReply.Id).ToList(); foreach (var chReply in childReplies) { var chReplies = GetProfileChildReplies(chReply); chldReplies.Add(new CommentWallViewModel() { Body = chReply.Body, ParentReplyId = chReply.ParentReplyId, DateTime = chReply.DateTime, Id = chReply.Id, UserName = chReply.UserName, WallChildReplies = chReplies }); } } return(chldReplies); }
public ActionResult NewChildReply(int preplyid, string comUserName, string replyBody, string ProfileUrl) { var preply = _profileFunctions.GetProfileReplyById(preplyid); var commentWallreply = new CommentWallReply() { ProfileId = preply.ProfileId, CommentId = preply.CommentId, ParentReplyId = preply.Id, DateTime = DateTime.Now, UserName = comUserName, Body = replyBody, }; _profileFunctions.AddNewWallReply(commentWallreply); //Think how we gat full profile here //return RedirectToAction("FullProfile", new { slug = _profileFunctions.GetPosts().Where(x => x.Id == preply.PostId).FirstOrDefault().UrlSeo }); //return RedirectToAction( _profileFunctions.GetUsers().Where(x => x.Id == preply.ProfileId).FirstOrDefault().ProfileUrl ); return(RedirectToAction(ProfileUrl)); }
public List <CommentWallViewModel> GetProfileChildReplies(CommentWallReply parentReply) { return(_profileFunctions.GetProfileChildReplies(parentReply)); }
public void AddNewWallReply(CommentWallReply commentWallReply) { _context.CommentWallReplies.Add(commentWallReply); Save(); }