public async Task <IActionResult> CanSendRecipeToUser(string email, int recipeId) { int userId; try { userId = IdentityHelper.GetUserId(User); } catch (UnauthorizedAccessException) { return(Unauthorized()); } var canSendDto = new CanSendDto(); var user = await _userService.GetAsync(email); if (user != null) { canSendDto.UserId = user.Id; canSendDto.ImageUri = user.ImageUri; var(canSend, alreadySent) = _recipeService.CheckSendRequest(recipeId, user.Id, userId); canSendDto.CanSend = canSend; canSendDto.AlreadySent = alreadySent; } return(Ok(canSendDto)); }