public AuthorsController(AuthorService authorService, UserService userService, TeamService teamService, ArtworkService artworkService) { _authorService = authorService; _userService = userService; _teamService = teamService; _artworkService = artworkService; }
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); } } }
public IHttpActionResult GetByTypes(string types) { ArtworkService artworkService = CreateArtworkService(); var artwork = artworkService.GetArtworkByTypes(types); return(Ok(artwork)); }
public IHttpActionResult GetByArtist(string artists) { ArtworkService artworkService = CreateArtworkService(); var artwork = artworkService.GetArtworkByArtist(artists); return(Ok(artwork)); }
public IHttpActionResult GetByMedium(string mediums) { ArtworkService artworkService = CreateArtworkService(); var artwork = artworkService.GetArtworkByMedium(mediums); return(Ok(artwork)); }
public IHttpActionResult Get(int id) { ArtworkService artworkService = CreateArtworkService(); var artwork = artworkService.GetArtworkById(id); return(Ok(artwork)); }
public IHttpActionResult GetByName(string name) { ArtworkService artworkService = CreateArtworkService(); var artwork = artworkService.GetArtworkByName(name); return(Ok(artwork)); }
public IHttpActionResult GetAll() { ArtworkService artworkService = CreateArtworkService(); var artwork = artworkService.GetArtwork(); return(Ok(artwork)); }
private ArtworkService CreateArtworkService() { var userId = Guid.Parse(User.Identity.GetUserId()); var artworkService = new ArtworkService(userId); return(artworkService); }
public IHttpActionResult GetCollection(int museum) { ArtworkService artworkService = CreateArtworkService(); var artworks = artworkService.GetArtworksAtMuseum(museum); return(Ok(artworks)); }
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(); }
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); }
public ArtworksController(ArtworkService artworkService, AuthorService authorService) { _artworkService = artworkService; _authorService = authorService; }
public ArtworkController() { service = new ArtworkService(); serviceUser = new UserServices(); serviceCategory = new CategoryService(); }