public IActionResult Index() { ViewBag.Title = "Bob's Home Page"; var pics = _picRepository.GetPics().OrderBy(p => p.Id); var pictures = new AppViewModels() { Pics = pics.ToList() }; return(View(pictures)); }
/// <summary> /// Constructor for the Application object. /// </summary> public App() { // Global handler for uncaught exceptions. UnhandledException += Application_UnhandledException; // Standard XAML initialization InitializeComponent(); // Phone-specific initialization InitializePhoneApplication(); // Language display initialization InitializeLanguage(); // Show graphics profiling information while debugging. if (Debugger.IsAttached) { // Display the current frame rate counters. Application.Current.Host.Settings.EnableFrameRateCounter = true; // Show the areas of the app that are being redrawn in each frame. //Application.Current.Host.Settings.EnableRedrawRegions = true; // Enable non-production analysis visualization mode, // which shows areas of a page that are handed off to GPU with a colored overlay. //Application.Current.Host.Settings.EnableCacheVisualization = true; // Prevent the screen from turning off while under the debugger by disabling // the application's idle detection. // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run // and consume battery power when the user is not using the phone. PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; } // Specify the local database connection string. string DBConnectionString = "Data Source=isostore:/LibDataBase.sdf"; // Create the database if it does not exist. using (var db = new LibraryDataContext(DBConnectionString)) { if (db.DatabaseExists() == false) { // Create the local database. db.CreateDatabase(); // //Prepopulate the records //LibDB.editors.InsertOnSubmit(new editor { Fullname = "one", Homepage = " asdf", Email = " asdf" }); //LibDB.editors.InsertOnSubmit(new editor { Fullname = "twoeditor", Homepage = " asdf", Email = " asdf" }); //LibDB.publishers.InsertOnSubmit(new publisher { Publisher = "pub1", Location = " asdf", Homepage = " asdf", Email = " asdf", Additioninfo = " asdf" }); //LibDB.publishers.InsertOnSubmit(new publisher { Publisher = "pub2", Location = " asdf", Homepage = " asdf", Email = " asdf", Additioninfo = " asdf" }); //LibDB.storages.InsertOnSubmit(new storage { Storage = "1", Address = " asdf", Additioninfo = " asdf" }); //LibDB.storages.InsertOnSubmit(new storage { Storage = "2", Address = " asdf", Additioninfo = " asdf" }); //LibDB.storages.InsertOnSubmit(new storage { Storage = "3", Address = " asdf", Additioninfo = " asdf" }); //LibDB.storages.InsertOnSubmit(new storage { Storage = "4", Address = " asdf", Additioninfo = " asdf" }); //LibDB.rooms.InsertOnSubmit(new room { Roomnumber = "room1", Storage_id = 1, Additioninfo = " asdf" }); //LibDB.rooms.InsertOnSubmit(new room { Roomnumber = "room2", Storage_id = 1, Additioninfo = " asdf" }); //LibDB.rooms.InsertOnSubmit(new room { Roomnumber = "room3", Storage_id = 1, Additioninfo = " asdf" }); //LibDB.rooms.InsertOnSubmit(new room { Roomnumber = "room4", Storage_id = 4, Additioninfo = " asdf" }); //LibDB.rooms.InsertOnSubmit(new room { Roomnumber = "room5", Storage_id = 3, Additioninfo = " asdf" }); //LibDB.rooms.InsertOnSubmit(new room { Roomnumber = "room6", Storage_id = 2, Additioninfo = " asdf" }); //LibDB.racks.InsertOnSubmit(new rack { Label = "rack1", Room_id = 1, Additioninfo = " asdf" }); //LibDB.racks.InsertOnSubmit(new rack { Label = "rack2", Room_id = 2, Additioninfo = " asdf" }); //LibDB.racks.InsertOnSubmit(new rack { Label = "rack3", Room_id = 2, Additioninfo = " asdf" }); //LibDB.racks.InsertOnSubmit(new rack { Label = "rack4", Room_id = 2, Additioninfo = " asdf" }); //LibDB.racks.InsertOnSubmit(new rack { Label = "rack5", Room_id = 5, Additioninfo = " asdf" }); //LibDB.racks.InsertOnSubmit(new rack { Label = "rack6", Room_id = 2, Additioninfo = " asdf" }); //LibDB.shelfs.InsertOnSubmit(new shelf { Rack_id = 1, Label = "shefl1", Additioninfo = " asdf" }); //LibDB.shelfs.InsertOnSubmit(new shelf { Rack_id = 1, Label = "shefl2", Additioninfo = " asdf" }); //LibDB.shelfs.InsertOnSubmit(new shelf { Rack_id = 2, Label = "shefl3", Additioninfo = " asdf" }); //LibDB.shelfs.InsertOnSubmit(new shelf { Rack_id = 1, Label = "shefl4", Additioninfo = " asdf" }); //LibDB.shelfs.InsertOnSubmit(new shelf { Rack_id = 5, Label = "shefl5", Additioninfo = " asdf" }); //LibDB.shelfs.InsertOnSubmit(new shelf { Rack_id = 2, Label = "shefl6", Additioninfo = " asdf" }); //LibDB.shelfs.InsertOnSubmit(new shelf { Rack_id = 2, Label = "shefl7", Additioninfo = " asdf" }); //LibDB.languages.InsertOnSubmit(new language { Language = "english", Additioninfo = " asdf" }); //LibDB.languages.InsertOnSubmit(new language { Language = "german", Additioninfo = " asdf" }); //LibDB.books.InsertOnSubmit(new book { Title = "adfkl", Subtitle = "asdf", Book_publisherid = 2, Book_shelfid = 1, Book_editorid = 2, Book_languageid = 2, Year = "2015", Edition = "2e", Isbn = "0124jg", Cover_link = " asdf", Cover_type = " asdf", Owncode = " asdf", Purchaseprice = "2.34", Page_number = "333", Recommend_for = " asdf", Loan_out_to = " asdf", Loan_out_date = " asdf", Preloan_condition = " asdf", Additioninfo1 = " asdf", Additioninfo2 = " asdf", Additioninfo3 = " asdf", Additioninfo4 = " asdf", Additioninfo5 = " asdf", Book_description = " asdf" }); //LibDB.books.InsertOnSubmit(new book { Title = "flower", Subtitle = "asdf", Book_publisherid = 2, Book_shelfid = 3, Book_editorid = 2, Book_languageid = 2, Year = "2015", Edition = "2e", Isbn = "0124jg", Cover_link = " asdf", Cover_type = " asdf", Owncode = " asdf", Purchaseprice = "2.34", Page_number = "333", Recommend_for = " asdf", Loan_out_to = " asdf", Loan_out_date = " asdf", Preloan_condition = " asdf", Additioninfo1 = " asdf", Additioninfo2 = " asdf", Additioninfo3 = " asdf", Additioninfo4 = " asdf", Additioninfo5 = " asdf", Book_description = " asdf" }); //LibDB.books.InsertOnSubmit(new book { Title = "bbbdl", Subtitle = "asdfdf", Book_publisherid = 1, Book_shelfid = 5, Book_editorid = 1, Book_languageid = 1, Year = "2015", Edition = "2e", Isbn = "0124jg", Cover_link = " asdf", Cover_type = " asdf", Owncode = " asdf", Purchaseprice = "dasf", Page_number = "333", Recommend_for = " asdf", Loan_out_to = "", Loan_out_date = "", Preloan_condition = " asdf", Additioninfo1 = " asdf", Additioninfo2 = " asdf", Additioninfo3 = " asdf", Additioninfo4 = " asdf", Additioninfo5 = " asdf", Book_description = " asdf" }); //LibDB.authors.InsertOnSubmit(new author { Fullname = "anana", Homepage = " asdf", Email = " asdf" }); //LibDB.authors.InsertOnSubmit(new author { Fullname = "flower", Homepage = " asdf", Email = " asdf" }); //LibDB.authors.InsertOnSubmit(new author { Fullname = "authorthree", Homepage = " asdf", Email = " asdf" }); //LibDB.books_authors.InsertOnSubmit(new book_author { Author_id = 1, Book_id = 1 }); //LibDB.books_authors.InsertOnSubmit(new book_author { Author_id = 2, Book_id = 1 }); //LibDB.books_authors.InsertOnSubmit(new book_author { Author_id = 2, Book_id = 2 }); //LibDB.reviews.InsertOnSubmit(new review { Authorid = 1, Bookid = 1, Additionalinfo = " asdf", Review = " asdf" }); //LibDB.reviews.InsertOnSubmit(new review { Authorid = 3, Bookid = 1, Additionalinfo = "f asdf", Review = "flowerthiss" }); //LibDB.reviews.InsertOnSubmit(new review { Authorid = 2, Bookid = 1, Additionalinfo = "f asdf", Review = "justflower" }); //LibDB.genres.InsertOnSubmit(new genre { Genre = "genre1", Addinfo = " asdf" }); //LibDB.genres.InsertOnSubmit(new genre { Genre = "genre2", Addinfo = " asdf" }); //LibDB.books_genres.InsertOnSubmit(new book_genre { Book_id = 1, Genre_id = 2 }); //LibDB.books_genres.InsertOnSubmit(new book_genre { Book_id = 1, Genre_id = 1 }); //LibDB.booksellers.InsertOnSubmit(new bookseller { Bookseller = "sales1", Address = " asdf", Email = " asdf", Homepage = " asdf", Phone = " asdf", Email_news = " asdf", Mail_news = " asdf", Additioninfo = " asdf" }); //LibDB.booksellers.InsertOnSubmit(new bookseller { Bookseller = "sales2", Address = " asdf", Email = " asdf", Homepage = " asdf", Phone = " asdf", Email_news = " asdf", Mail_news = " asdf", Additioninfo = " asdf" }); //LibDB.books_booksellers.InsertOnSubmit(new book_bookseller { Book_id = 1, Bookseller_id = 2 }); //LibDB.books_booksellers.InsertOnSubmit(new book_bookseller { Book_id = 1, Bookseller_id = 1 }); //// Save categories to the database. //db.SubmitChanges(); } } _allViewModels = new AppViewModels(DBConnectionString); _allViewModels.LoadHomePageData(); }