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 })); }
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(); }
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)); }