public async Task <IActionResult> Post(int id) { Publication post = _publicationService.GetPostDB(id); ViewBag.Videos = await _videoService.GetAllVideos(post.Id); if (post == null) { return(NotFound()); } return(View(@post)); }
//public void Hello(int postId) // передаем id комента //{ // var com = _comment.AllComments(postId); //айди поста // int count = 0; // foreach (var c in com) // { // var likes = _likeService.GetAllLikes(c.Id); // foreach (var item in likes) // { // count += 1; // } // c.polelike = count; // } //} public Comment CreateComment(CreateCommentViewModel model, int ID, string login) { Comment comment = new Comment { CommentText = model.CommentText, LoginUser = login,//_user.GetUserDB(_userManager.GetUserId(User)).UserName, PublicationID = ID, Publication = _publicationService.GetPostDB(ID) }; _comment.AddCommentDB(comment); return(comment); }
public async Task <Video> AddVideo(int id, VideoViewModel video) { var module = _publicationService.GetPostDB(id); Video new_video = new Video { // Id = Guid.NewGuid(), Name = video.Name, Url = video.Url, PublicationId = module.Id, }; await _video.AddVideo(new_video); return(new_video); }