protected IQueryable <Book> SetUpBooks(IQueryable <ApplicationUser> users) { var books = new List <Book>(); var importer = new SeedImporter(); var userArray = users.OrderBy(u => u.Id).ToArray(); foreach (var book in importer.Get <Book>()) { // Distribute books to each user until we run out var owner = userArray[(book.ID - 1) % userArray.Length]; var newBook = new Book() { ID = book.ID, Owner = owner, OwnerId = owner.Id, Title = book.Title, Author = book.Author, Rating = book.Rating, ISBN = book.ISBN }; books.Add(newBook); owner.Books.Add(newBook); } return(books.AsQueryable()); }
protected IQueryable <ApplicationUser> SetUpApplicationUsers() { var userList = new List <ApplicationUser>(); var importer = new SeedImporter(); foreach (var user in importer.Get <ApplicationUser>()) { userList.Add(new ApplicationUser { Id = user.Id, GivenName = user.GivenName, FamilyName = user.FamilyName, About = user.About, Email = user.Email, Address1 = user.Address1, City = user.City, State = user.State, Postal = user.Postal, Country = user.Country, Latitude = user.Latitude, Longitude = user.Longitude, BirthDate = user.BirthDate, Books = new List <Book>(), Users = new List <Friendship>(), Friendships = new List <Friendship>() }); } return(userList.AsQueryable()); }