public static int[] AddBooks(int number, DbAccessLayer mgr) { var books = new List<Book>(); for (int i = 0; i < number; i++) { var book = new Book(); book.BookName = Guid.NewGuid().ToString(); books.Add(mgr.InsertWithSelect(book)); } return books.Select(f => f.BookId).ToArray(); }
public static long[] AddUsers(int number, DbAccessLayer mgr) { var users = new List<Users>(); for (int i = 0; i < number; i++) { var user = new Users(); user.UserName = Guid.NewGuid().ToString(); users.Add(mgr.InsertWithSelect(user)); } return users.Select(f => f.User_ID).ToArray(); }
public static int[] AddBooksWithImage(int number, int imagesPerBook, DbAccessLayer mgr) { var books = new List<Book>(); for (int i = 0; i < number; i++) { var book = new Book(); book.BookName = Guid.NewGuid().ToString(); books.Add(book = mgr.InsertWithSelect(book)); for (int j = 0; j < imagesPerBook; j++) { mgr.Insert(new Image() { Text = Guid.NewGuid().ToString(), IdBook = book.BookId }); } } return books.Select(f => f.BookId).ToArray(); }
public static long[] AddImages(int number, DbAccessLayer mgr) { var images = new List<Image>(); for (int i = 0; i < number; i++) { var image = new Image(); image.Text = Guid.NewGuid().ToString(); images.Add(mgr.InsertWithSelect(image)); } return images.Select(f => f.ImageId).ToArray(); }