public async Task <ActionResult <ResponseAddComment> > Post([FromForm] AddReplayModel data) { if (this.User.Identity.IsAuthenticated) { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); await this.replaysService.CreateReplayAsync(data, userId); return(new ResponseAddComment() { Status = "Created" }); } return(this.Unauthorized()); }
public async Task CreateReplayAsync(AddReplayModel input, string userId) { string url = null; if (input.File != null) { url = await this.cloudinaryService.SaveCloudinaryAsync(input.File); } var comment = new Comment() { Description = input.Description, ReplayId = input.CommentId, ApplicationUserId = userId, PostId = input.PostId, ImgUrl = url, }; await this.replayRepository.AddAsync(comment); await this.replayRepository.SaveChangesAsync(); }