Пример #1
0
        public async Task <IActionResult> AddNewComment(AddNewCommentViewModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(View(input));
            }

            input.PhotographyAddictedUserId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            await newCommentService.AddNewComment(input);

            return(this.RedirectToAction("PreviewNew", "News", new { id = input.NewId }));
        }
Пример #2
0
        public async Task AddNewComment(AddNewCommentViewModel input)
        {
            var newComment = new NewComment
            {
                PhotographyAddictedUserId = input.PhotographyAddictedUserId,
                // PhotographyAddictedUser = input.PhotographyAddictedUser,
                NewId = input.NewId,
                //Theme = input.Theme,
                UserOpinion  = input.UserOpinion,
                CreationDate = DateTime.UtcNow,
            };

            await newCommentDbSet.AddAsync(newComment);

            await newCommentDbSet.SaveChangesAsync();
        }
Пример #3
0
        public IActionResult AddNewComment(int Id)
        {
            var isNewExist = this.newService.FindNewBy(Id);

            if (isNewExist == null)
            {
                return(this.RedirectToAction("Index", "Home"));
            }

            var newThemeComment = new AddNewCommentViewModel()
            {
                NewId = Id,
            };

            return(View(newThemeComment));
        }