private List<User> GetUsers() { var loc1 = new Location() { Id = 1, Name = "one" }; var loc2 = new Location() { Id = 2, Name = "two" }; var user1 = new User() { Id = 1, Deparments = new List<Department>() { new Department() {Id = 1, Distance = 123.45m, Size = 2, Location = loc1}, new Department() {Id = 2, Distance = 400, Size = 1, Location = loc2} } }; var user2 = new User() { Id = 2, Deparments = new List<Department>() { new Department() {Id = 3, Distance = 500, Size = 1, Location = loc2}, new Department() {Id = 4, Distance = 125.5m, Size = 3, Location = loc1} } }; var user3 = new User() { Id = 3, Deparments = new List<Department>() { new Department() {Id = 5, Distance = 5, Size = 5, Location = loc2}, } }; var user4 = new User() { Id = 4, Deparments = new List<Department>() { new Department() {Id = 6, Distance = 100, Size = 10, Location = loc1}, } }; return new List<User>() { user1, user2, user3, user4 }; }
private async Task<List<User>> GetUsersAsync() { var loc1 = new Location() { Id = 1, Name = "one" }; var loc2 = new Location() { Id = 2, Name = "two" }; var user1 = new User() { Id = 1, Deparments = new List<Department>() { new Department() {Id = 1, Distance = 123.45m, Size = 2, Location = loc1}, new Department() {Id = 2, Distance = 400, Size = 1, Location = loc2} } }; var user2 = new User() { Id = 2, Deparments = new List<Department>() { new Department() {Id = 3, Distance = 500, Size = 1, Location = loc2}, new Department() {Id = 4, Distance = 125.5m, Size = 3, Location = loc1} } }; return await Task.FromResult<List<User>>(new List<User>() { user1, user2 }); }