public IActionResult CreatePhotoComment(string id, string userId) { var viewModel = new CommentsPhotoModel { PhotoId = id, UserId = userId, }; return(this.View(viewModel)); }
public async Task <IActionResult> CreatePhotoComment(CommentsPhotoModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } var userId = this.userManager.GetUserId(this.User); await this.commentsService.CreatePhotoCommentAsync(model.PhotoId, model.UserId, model.Content, userId); return(this.Redirect($"/Photos/Photo?id={model.PhotoId}")); }