Beispiel #1
0
        public async Task <IActionResult> AddImageComment(AddImageCommentViewModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(View(input));
            }

            input.PhotographyAddictedUserId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            await imageCommentService.AddImageComment(input);

            return(this.RedirectToAction("PreviewImage", "Images", new { id = input.ImageId }));
        }
Beispiel #2
0
        public async Task AddImageComment(AddImageCommentViewModel input)
        {
            var imageComment = new ImageComment
            {
                PhotographyAddictedUserId = input.PhotographyAddictedUserId,
                ImageId      = input.ImageId,
                UserOpinion  = input.UserOpinion,
                CreationDate = DateTime.UtcNow,
            };

            await imageCommentDbSet.AddAsync(imageComment);

            await imageCommentDbSet.SaveChangesAsync();
        }
Beispiel #3
0
        public IActionResult AddImageComment(int Id)
        {
            var image = imageService.PreviewImage(Id);

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

            var imageComment = new AddImageCommentViewModel()
            {
                ImageId = Id,
            };

            return(View(imageComment));
        }