コード例 #1
0
        public async Task <IActionResult> AddThemeComment(AddThemeCommentViewModel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(View(input));
            }

            input.PhotographyAddictedUserId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            await themeCommentService.AddThemeComment(input);

            return(this.RedirectToAction("PreviewTheme", "Themes", new { id = input.ThemeId }));
        }
コード例 #2
0
        public async Task AddThemeComment(AddThemeCommentViewModel input)
        {
            var themeComment = new ThemeComment
            {
                PhotographyAddictedUserId = input.PhotographyAddictedUserId,
                PhotographyAddictedUser   = input.PhotographyAddictedUser,
                ThemeId      = input.ThemeId,
                Theme        = input.Theme,
                UserOpinion  = input.UserOpinion,
                CreationDate = DateTime.UtcNow,
            };

            await themeCommentDbSet.AddAsync(themeComment);

            await themeCommentDbSet.SaveChangesAsync();
        }
コード例 #3
0
        public IActionResult AddThemeComment(int Id)
        {
            var isThemeExist = themeService.FindThemeBy(Id);

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

            var newThemeComment = new AddThemeCommentViewModel()
            {
                ThemeId = Id,
            };

            return(View(newThemeComment));
        }