public async Task <PhotoListResponse> ReceiveMessageAsync() { // All photos are from the same user var username = await _networkCommunication.ReceiveStringAsync(); // Receive array of photos var photos = new List <Photo>(); var count = await _networkCommunication.ReceiveIntAsync(); for (var i = 0; i < count; i++) { var name = await _networkCommunication.ReceiveStringAsync(); var file = await _fileCommunication.ReceiveFileAsync(); photos.Add(new Photo { Name = name, File = file, Username = username }); } return(new PhotoListResponse(username, photos)); }
public async Task <CommentListResponse> ReceiveMessageAsync() { // All comments are from the same photo var username = await _networkCommunication.ReceiveStringAsync(); var photoName = await _networkCommunication.ReceiveStringAsync(); // Receive array of comments var comments = new List <Comment>(); var count = await _networkCommunication.ReceiveIntAsync(); for (var i = 0; i < count; i++) { var text = await _networkCommunication.ReceiveStringAsync(); comments.Add(new Comment { Username = username, PhotoName = photoName, Text = text }); } return(new CommentListResponse(username, photoName, comments)); }
public async Task <UserListResponse> ReceiveMessageAsync() { // Receive array of photos var users = new List <User>(); var count = await _networkCommunication.ReceiveIntAsync(); for (var i = 0; i < count; i++) { var userName = await _networkCommunication.ReceiveStringAsync(); users.Add(new User { Username = userName, Password = "******" }); } return(new UserListResponse(users)); }