public async Task <IActionResult> CanShareRecipeWithUser(string email) { int userId; try { userId = IdentityHelper.GetUserId(User); } catch (UnauthorizedAccessException) { return(Unauthorized()); } var canShareVm = new CanShareVm { CanShare = false }; var user = await _userService.GetAsync(email); if (user != null) { canShareVm.UserId = user.Id; canShareVm.ImageUri = user.ImageUri; canShareVm.CanShare = _recipeService.CanShareWithUser(user.Id, userId); } return(Ok(canShareVm)); }