public async Task <WallResult> Get() { WallResult result = new WallResult(); // First Get All friends var a = await friends.Get(); List <GetFriendModel> Friends = a.ToList(); foreach (GetFriendModel friend in Friends) { var b = await posts.Get(friend.FriendUserId); List <PostDetailsOutputModel> Posts = b.ToList(); foreach (PostDetailsOutputModel post in Posts) { var c = await likes.Get(post.Id); result.Posts.Add(new PostWithLikesDetailsOutputModel() { User = friend.FriendUserId, Title = post.Title, Text = post.Text, Likes = c.Likes }); } } return(result); }
public async Task Initialize() { try { var friendsFetched = await m_friendsService.Get(); foreach (var friend in friendsFetched) { Friends.Add(new FriendViewModel(friend)); } } catch (Exception exception) { //Log it, fix it or show it } }
public async Task <IActionResult> Get() { try { var userId = await GetUserId(); if (!Equals(userId, Guid.Empty)) { var friends = await _service.Get(userId); return(Ok(friends)); } return(BadRequest()); } catch (Exception ex) { throw ex; } }
public async Task Initialize(IHandleFriendChanged friendChangedHandler) { try { IsBusy = true; var friendsFetched = await m_friendsService.Get(); foreach (var friend in friendsFetched) { Friends.Add(new FriendViewModel(friend, friendChangedHandler)); } } catch (Exception exception) { //Log it, fix it or show it } finally { IsBusy = false; } }
public HttpResponseMessage Get(int userId) { var result = _friendsService.Get(userId); return(Request.CreateResponse(HttpStatusCode.OK, result)); }
public async Task <IActionResult> Get(string q) { var model = await _friendsService.Get(q); return(Ok(model)); }