Exemple #1
0
 public AuthorsController(AuthorService authorService, UserService userService, TeamService teamService, ArtworkService artworkService)
 {
     _authorService  = authorService;
     _userService    = userService;
     _teamService    = teamService;
     _artworkService = artworkService;
 }
Exemple #2
0
        private void GetArtwork(string artist, string album)
        {
            var service = new ArtworkService();

            byte[] data = service.GetArtwork(artist, album);

            Assert.IsNotNull(data);
            Assert.AreNotEqual(0, data.Length);

            string path = GetArchivePath();

            if (path != null)
            {
                path = Path.Combine(path,
                                    String.Format("{0}_{1}{2}", artist, album, Path.GetExtension(service.FileName)));

                if (File.Exists(path))
                {
                    File.Delete(path);
                }

                Console.WriteLine("Creating file " + path);

                using (var writer = File.Create(path))
                {
                    writer.Write(data, 0, data.Length);
                }
            }
        }
Exemple #3
0
        public IHttpActionResult GetByTypes(string types)
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artwork        = artworkService.GetArtworkByTypes(types);

            return(Ok(artwork));
        }
Exemple #4
0
        public IHttpActionResult GetByArtist(string artists)
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artwork        = artworkService.GetArtworkByArtist(artists);

            return(Ok(artwork));
        }
Exemple #5
0
        public IHttpActionResult GetByMedium(string mediums)
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artwork        = artworkService.GetArtworkByMedium(mediums);

            return(Ok(artwork));
        }
Exemple #6
0
        public IHttpActionResult Get(int id)
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artwork        = artworkService.GetArtworkById(id);

            return(Ok(artwork));
        }
Exemple #7
0
        public IHttpActionResult GetByName(string name)
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artwork        = artworkService.GetArtworkByName(name);

            return(Ok(artwork));
        }
Exemple #8
0
        public IHttpActionResult GetAll()
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artwork        = artworkService.GetArtwork();

            return(Ok(artwork));
        }
Exemple #9
0
        private ArtworkService CreateArtworkService()
        {
            var userId         = Guid.Parse(User.Identity.GetUserId());
            var artworkService = new ArtworkService(userId);

            return(artworkService);
        }
Exemple #10
0
        public IHttpActionResult GetCollection(int museum)
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artworks       = artworkService.GetArtworksAtMuseum(museum);

            return(Ok(artworks));
        }
Exemple #11
0
        public IHttpActionResult GetByEra(string era)
        {
            ArtworkService artworkService = CreateArtworkService();
            var            artwork        = artworkService.GetArtworkByEra(era);

            return(Ok(artwork));
        }
 public ExposureController()
 {
     service    = new ExposureService();
     serviceA   = new ArtworkService();
     ServiceS   = new SpaceServices();
     ServiceArt = new ExpositionArtworkService();
     ServiceU   = new UserServices();
     ServicExpositionArtwork = new ExpositionArtworkService();
 }
Exemple #13
0
        private string GetArtworkPath(string artist, string album)
        {
            ArtworkService service = new ArtworkService();

            byte[] data = service.GetArtwork(artist, album);

            if ((data != null) && (data.Length > 0))
            {
                // store the image in CommonDataPath so all users on the machine can take
                // advantage of this cache...
                // make sure the filename is 'cleaned' because some tracks have quite a random
                // array of characters in their names!

                string path = Path.Combine(
                    PathHelper.CommonDataPath,
                    PathHelper.CleanFileName(
                        String.Format(
                            "{0}_{1}{2}",
                            artist, album, Path.GetExtension(service.FileName))
                        )
                    );

                if (File.Exists(path))
                {
                    File.Delete(path);
                }

                using (var writer = File.Create(path))
                {
                    writer.Write(data, 0, data.Length);
                }

                return(path);
            }

            return(null);
        }
Exemple #14
0
 public ArtworksController(ArtworkService artworkService, AuthorService authorService)
 {
     _artworkService = artworkService;
     _authorService  = authorService;
 }
 public ArtworkController()
 {
     service         = new ArtworkService();
     serviceUser     = new UserServices();
     serviceCategory = new CategoryService();
 }