Beispiel #1
0
        public List <AlbumViewModel> GetModalinform()
        {
            SoulfulBackStage           context          = new SoulfulBackStage();
            SoulfulRepository <Singer> SingerRepository = new SoulfulRepository <Singer>(context);
            SoulfulRepository <Album>  AlbumRepository  = new SoulfulRepository <Album>(context);

            var albumContext = from Album in AlbumRepository.GetAll()
                               join Singer in SingerRepository.GetAll()
                               on Album.Singer_id equals Singer.Singer_id
                               select new AlbumViewModel
            {
                Album_Name = Album.Album_Name,
                About      = Album.About,
                Pic        = Album.Pic,
                Singer     = Singer.Name,
                Singer_id  = Singer.Singer_id,
                Company    = Album.Company,
                Datetime   = Album.Datetime,
                Album_id   = Album.Album_id,
                Price      = Album.Price,
                Hits       = Album.Hits,
                WeekHits   = Album.WeekHits,
                MonthHits  = Album.MonthHits
            };

            return(albumContext.ToList());
        }
Beispiel #2
0
        public SoulfulRepository(SoulfulBackStage context)
        {
            if (context == null)
            {
                throw new ArgumentNullException();
            }

            _context = context;
        }
Beispiel #3
0
        public List <HitViewModel> GetMonthHits()
        {
            SoulfulBackStage          context         = new SoulfulBackStage();
            SoulfulRepository <Album> AlbumRepository = new SoulfulRepository <Album>(context);

            var albumContext = from Album in AlbumRepository.GetAll().OrderBy(x => x.Album_Name)
                               orderby Album.MonthHits descending
                               select new HitViewModel
            {
                Name      = Album.Album_Name,
                MonthHits = Album.MonthHits
            };

            return(albumContext.Take(10).ToList());
        }