public async Task <ActionResult> Send(Guid suggestionId, UserReaction reaction) { var user = await _userManager.FindByNameAsync(User.Identity.Name); if (user == null) { return(RedirectToAction("Register", "Authentication")); } bool isSuggestionExist = await _suggestionService.AnyAsync(suggestionId); if (!isSuggestionExist) { return(RedirectToAction("Index", "Home")); } bool isAlreadyReacted = await _service.AnyAsync(a => a.CreateBy == user.Id && a.SuggestionId == suggestionId); if (isAlreadyReacted) { return(RedirectToAction("Detail", "Suggestion", new { id = suggestionId })); } SuggestionReactionSaveVM model = new SuggestionReactionSaveVM() { SuggestionId = suggestionId, Reaction = reaction }; var result = await _service.AddAsync(model, user.Id); if (result.IsSuccessful) { await _suggestionService.UpdateReactionCount(suggestionId, reaction); } return(RedirectToAction("Detail", "Suggestion", new { id = suggestionId })); }