public async Task<ActionResult<LikeResponseModel>> Like(LikeInputModel inputModel) { var userId = this.User.FindFirst(ClaimTypes.NameIdentifier).Value; var isLiked = await this.likesService.LikeAsync(inputModel.CommentId, userId); var likes = this.likesService.GetLikes(inputModel.CommentId); return new LikeResponseModel { LikesCount = likes, IsLiked = isLiked }; }
public async Task <ActionResult <LikeResponseModel> > Post(LikeInputModel input) { var userId = this.userManager.GetUserId(this.User); await this.likesService.LikeAsync(input.PostId, userId); var likes = this.likesService.GetLikesCount(input.PostId); return(likes); }
public async Task <ActionResult <LikesResponseModel> > Beat(LikeInputModel input) { var userId = this.userManager.GetUserId(this.User); bool isLiked = await this.likeService.VoteAsync(input.BeatId, userId); var ownerId = this.beatsService.FindUserIdByBeatId(input.BeatId); var beatName = this.beatsService.GetBeatNameByBeatId(input.BeatId); if (isLiked == true) { await this.notificationsService.SendNotificationAsync(ownerId, string.Format(GlobalConstants.LikeNotification, $"{this.User.Identity.Name}", $"{beatName}"), "Like"); } var likes = this.likeService.GetLikes(input.BeatId); return(new LikesResponseModel { LikesCount = likes, IsLiked = isLiked }); }
public async Task DislikeTattoo([FromBody] LikeInputModel likeModel) { var profileId = _userManager.GetProfileId(User); await _tattooService.RemoveLike(profileId, likeModel.TattooId); }