Example #1
0
        public async Task <ActionResult <InfoViewOneFilm> > GetFilm(int id)
        {
            var film = mapper.Map <InfoViewOneFilm>(await filmRepository.GetFilm(id));

            if (film == null)
            {
                return(NotFound("Sorry, but this film doesn't exist :" + id.ToString()));
            }
            if (film.FilmImage == null)
            {
                film.FilmImage = ImageDefaultNames.DEFAULT_FILM_IMAGE_NAME;
            }
            film.FilmImageUrl = await resourcePathResolver.Take(new TakingImageModel(Types.Film, film.FilmImage));

            return(film);
        }
Example #2
0
        private async Task <string> TakingImage(Types type, string fileName)
        {
            if (fileName == null)
            {
                fileName = (type == Types.Film) ?
                           ImageDefaultNames.DEFAULT_FILM_IMAGE_NAME :
                           ImageDefaultNames.DEFAULT_USER_IMAGE_NAME;
            }
            string imagePath = await resourcePathResolver.Take(new TakingImageModel(type, fileName));

            return(imagePath);
        }