示例#1
0
        public ActionResult Index()
        {
            IEnumerable <AuthorBLL> authorsBLL = dbGet.GetAllAuthors();

            Mapper.Initialize(cfg => cfg.CreateMap <AuthorBLL, AuthorViewModel>());
            ICollection <AuthorViewModel> authorList = Mapper.Map <IEnumerable <AuthorBLL>, IEnumerable <AuthorViewModel> >(authorsBLL).ToList();

            authorList.OrderBy(author => author.AuthorName);
            return(View(authorList));
        }
示例#2
0
        public ActionResult Index()
        {
            IEnumerable <TrackBLL> tracksBLL = dbGet.GetAllTracks();

            Mapper.Initialize(cfg => cfg.CreateMap <TrackBLL, TrackViewModel>());
            ICollection <TrackViewModel> trackList  = Mapper.Map <IEnumerable <TrackBLL>, IEnumerable <TrackViewModel> >(tracksBLL).ToList();
            IEnumerable <AuthorBLL>      authorsBLL = dbGet.GetAllAuthors().ToList();

            Mapper.Initialize(cfg => cfg.CreateMap <AuthorBLL, AuthorViewModel>());
            ICollection <AuthorViewModel> authors = Mapper.Map <IEnumerable <AuthorBLL>, IEnumerable <AuthorViewModel> >(authorsBLL).ToList();

            ViewBag.Authors = authors;
            return(View(trackList));
        }