Beispiel #1
0
 public async Task <ActionResult> DetailAllbum(HttpPostedFileBase[] files, int _abid)
 {
     try
     {
         foreach (HttpPostedFileBase file in files)
         {
             ImageUploadViewModel item = new ImageUploadViewModel();
             item = cms_db.UploadHttpPostedFileBase(file);
             MediaContentViewModels _Media = new MediaContentViewModels();
             _Media.Filename         = item.ImageName;
             _Media.FullURL          = item.ImageUrl;
             _Media.ContentObjId     = _abid;
             _Media.ObjTypeId        = (int)EnumCore.ObjTypeId.album;
             _Media.ViewCount        = 0;
             _Media.CrtdDT           = DateTime.UtcNow;
             _Media.MediaContentSize = file.ContentLength;
             _Media.ThumbURL         = item.ImageThumbUrl;
             _Media.CrtdUID          = long.Parse(User.Identity.GetUserId());
             _Media.MediaTypeId      = (int)EnumCore.mediatype.hinh_anh;
             long _ImgId = await cms_db.AddNewMediaContent(_Media);
         }
         DetailAlbumViewModel model = new DetailAlbumViewModel();
         model.Album    = cms_db.GetObjClasscifiById(_abid);
         model.lstImage = cms_db.GetLstMediaContentByAlbumId(_abid);
         return(View(model));
     }
     catch (Exception e)
     {
         cms_db.AddToExceptionLog("DetailAllbum", "MediaManager", e.ToString());
         return(RedirectToAction("ErrorExeption", "Extension"));
     }
 }
        public IActionResult DetailAlbum(int id)
        {
            Album albumfromDb = _applicationDbContext.Albums
                                .Include(x => x.AlbumSongs)
                                .SingleOrDefault(x => x.Id == id);

            List <SongListViewModel> addSongs = new List <SongListViewModel>();

            foreach (var song in albumfromDb.AlbumSongs)
            {
                var newSongToAlbum = new SongListViewModel()
                {
                    Title   = song.Titel,
                    Artist  = song.Artist,
                    Release = song.Release,
                    Id      = song.Id
                };
                addSongs.Add(newSongToAlbum);
            }

            DetailAlbumViewModel albumDetail = new DetailAlbumViewModel()
            {
                Id                = albumfromDb.Id,
                Cover             = albumfromDb.Cover,
                Title             = albumfromDb.Titel,
                SongsToAddToAlbum = addSongs,
            };


            return(View(albumDetail));
        }
Beispiel #3
0
        public DetailAlbumViewModel Detail(string id)
        {
            var album = this.db.Albums.Find(id);

            var tracks = this.db.Tracks
                         .Where(t => t.Album.Id == id)
                         .ToArray();

            var trackCollection = new List <TrackViewModel>();

            foreach (var track in tracks)
            {
                var trackViewModel = new TrackViewModel()
                {
                    Id   = track.Id,
                    Name = track.Name,
                };

                trackCollection.Add(trackViewModel);
            }

            var albumViewModel = new DetailAlbumViewModel()
            {
                Name   = album.Name,
                Price  = album.Price,
                Tracks = trackCollection,
                Id     = album.Id,
                Cover  = album.Cover
            };

            return(albumViewModel);
        }
Beispiel #4
0
        public ActionResult AlbumDetails(string id)
        {
            var album = albumRepository.GetAlbumByID(id);
            DetailAlbumViewModel model = AlbumMapper.MapDetailAlbumViewModel(album);

            return(PartialView("_AlbumDetails", model));
        }
        public ActionResult Detail(Guid id)
        {
            var response = _albumService.GetAlbum(new GetAlbumRequest {
                Id = id
            });

            var model = new DetailAlbumViewModel {
                Album = response.Album
            };

            return(View(model));
        }
Beispiel #6
0
 public ActionResult DetailAllbum(int id)
 {
     try
     {
         DetailAlbumViewModel model = new DetailAlbumViewModel();
         model.Album    = cms_db.GetObjClasscifiById(id);
         model.lstImage = cms_db.GetLstMediaContentByAlbumId(id);
         return(View(model));
     }
     catch (Exception e)
     {
         cms_db.AddToExceptionLog("DetailAllbum", "MediaManager", e.ToString());
         return(RedirectToAction("ErrorExeption", "Extension"));
     }
 }