示例#1
0
        public ActionResult ViewAllAlbums()
        {
            var albumRepo = new AlbumRepo();
            var albums    = albumRepo.GetAll().Select(x => new Album(x)).ToList();

            return(PartialView(albums));
        }
示例#2
0
        public ActionResult Index()
        {
            List <AlbumEntity> albumEntities = AlbumRepo.GetAll();

            List <AlbumModel> albumModels = new List <AlbumModel>();

            foreach (var albumEntity in albumEntities)
            {
                albumModels.Add(EntityModelMapper.EntityToModel(albumEntity));
            }

            return(View(albumModels));
        }
示例#3
0
        public ActionResult Index(AlbumModel album, string albumComment)
        {
            CommentModel commentModel = new CommentModel()
            {
                Comment     = albumComment,
                DateCreated = DateTime.Now,
                Album       = album,
            };

            var commentEntity = EntityModelMapper.ModelToEntity(commentModel);

            CommentRepo.NewAlbumComment(album.AlbumModelId, commentEntity);

            return(View(AlbumRepo.GetAll()));
        }