public AddOrderDetailWindow(Order newOrder)
 {
     InitializeComponent();
     _newOrder = newOrder;
     CreateOrderDetail();
     albumComboBox.ItemsSource = AlbumRepository.GetAlbums();
     mainGrid.DataContext      = _newOrderDetail;
 }
        public IActionResult Index()
        {
            var repository = new AlbumRepository();
            var model      = repository.GetAlbums().Select(a => new AlbumModel
            {
                AlbumId = a.AlbumId,
                Genre   = new GenreModel {
                    Name = a.Genre.Name
                },
                Title = a.Title,
                Price = a.Price
            }).ToList();

            return(View(model));
        }
Пример #3
0
 public async Task GetAlbums()
 {
     // Arrange
     var options = new DbContextOptionsBuilder<MyAlbumDbContext>()
         .UseInMemoryDatabase(databaseName: "AlbumRepository_GetAlbums_MyAlbumDatabase")
         .Options;
     using (var context = new MyAlbumDbContext(options))
     {
         IEnumerable<Album> seedAlbums = SeedAlbums(context);
         AlbumRepository albumRepository = new AlbumRepository(context);
         AlbumQuery filter = new AlbumQuery();
         // Act
         var albums = await albumRepository.GetAlbums(filter);
         // Assert
         Assert.Equal(seedAlbums, albums);
     }            
 }        
Пример #4
0
        // GET: Gallery
        public ActionResult Index()
        {
            //if (Session["UserId"] != null)
            //{
            //    var photoList = Dal.GetPhotos().Select(x => new Photo(x)).ToList();
            //    return View(photoList);
            //}
            //return RedirectToAction("Login", "Account");


            // Test till Album
            var albumRepo = new AlbumRepository();

            if (Session["UserId"] != null)
            {
                var albumList = albumRepo.GetAlbums().Select(x => new Album(x)).ToList();
                return(View(albumList));
            }
            return(RedirectToAction("Login", "Account"));
        }
        public AllAlbumsPage()
        {
            InitializeComponent();

            albumDataGrid.ItemsSource = AlbumRepository.GetAlbums();
        }