public PictureCommentReplay PictureCommentReplay(PictureCommentReplay pictureCommentReplay) { try { var _replaycomments = new PictureCommentReplay(); string UserId = _session.GetString("UserId"); var _getComment = GetCommentsbyId(pictureCommentReplay.PictureCommentId); if (_getComment != null) { if (pictureCommentReplay.Id == 0) { _replaycomments.Message = pictureCommentReplay.Message; _replaycomments.PictureCommentId = pictureCommentReplay.PictureCommentId; _replaycomments.FriendId = _getComment.UserId; _replaycomments.UserId = int.Parse(UserId); _replaycomments.DateCreated = DateTime.Now; _context.PictureCommentReplays.Add(_replaycomments); } else { _replaycomments = GetCommentReplaybyId(pictureCommentReplay.Id); if (_replaycomments != null) { _replaycomments.Message = pictureCommentReplay.Message; _replaycomments.DateModified = DateTime.Now; _replaycomments.DateDeleted = null; _context.PictureCommentReplays.Update(_replaycomments); } } } _accountRepository.Save(); return(_replaycomments); } catch (Exception) { throw; } }
public JsonResult SendCommentReplay(PictureCommentReplay comments) { var data = _commentRepository.PictureCommentReplay(comments); return(Json(data)); }