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