Пример #1
0
 public ActionResult AddComent(int id)
 {
     var user = _userBl.GetUserByLogin(User.Identity.Name);
     var commentModel = new CommentModel()
     {
         CreatorId = user.Id,
         CommentText = null,
         RequestId = id
     };
     return View(commentModel);
 }
Пример #2
0
 public ActionResult AddComent(CommentModel commentModel)
 {
     if (ModelState.IsValid)
     {
         var comment = new Comment
         {
             CommentText = commentModel.CommentText,
             CreatorId = commentModel.CreatorId,
             RequestId = commentModel.RequestId
         };
         _userBl.CreateComment(comment);
         return RedirectToAction("GetRequestDetails" + "/" + Convert.ToString(commentModel.RequestId), "UserProfile");
     }
     return View(commentModel);
 }
Пример #3
0
 //[HttpGet]
 public ActionResult GetCommentsList(int requestId)
 {
     var commentList = new List<CommentModel>();
     var comments = _userBl.GetAllCommentsByRequestId(requestId);
     foreach (var comment in comments)
     {
         var commentModel = new CommentModel()
         {
             Id = comment.Id,
             CommentText = comment.CommentText,
             RequestId = comment.RequestId,
             CreatorId = comment.CreatorId
         };
         commentList.Add(commentModel);
     }
     return View(commentList);
 }