public async Task <IActionResult> CommentOnPhoto(CommentsViewModel model) { if (!ModelState.IsValid) { return(View("CommentOnPhoto", model)); } model.Photo = _commentedPhoto; var user = await _userManager.GetUserAsync(HttpContext.User); User myUser = _repository.GetUser(user.Id); await _repository.PostCommentAsync(model.Photo, myUser, model.Text); return(RedirectToAction("Index")); }