public async Task <IActionResult> GetPendingFriends() { var userId = _userManager.GetUserId(HttpContext.User); var ids = _friendsRepository.GetPendingFriends(userId).ToList(); IList <User> result = new List <User> { }; foreach (var id in ids) { var email = (await _userManager.FindByIdAsync(id)).Email; result.Add(new Models.User { Id = id, Email = email }); } return(new OkObjectResult(result)); }
/// <summary> /// Get a list of all Pending friends by the userId /// </summary> /// <param name="userId"></param> /// <returns></returns> public List <Friend> GetRequestingFriends(int userId) => _repository.GetPendingFriends(userId);
public List <Friend> GetPendingFriends(int userId) { return(_context.GetPendingFriends(userId)); }