Exemple #1
0
        public IActionResult CreatePhotoComment(string id, string userId)
        {
            var viewModel = new CommentsPhotoModel
            {
                PhotoId = id,
                UserId  = userId,
            };

            return(this.View(viewModel));
        }
Exemple #2
0
        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}"));
        }