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