Ejemplo n.º 1
0
        public async Task <IActionResult> GetDesigner(int id)
        {
            var designer = await _designersRepository.GetAsync(id);

            if (designer == null)
            {
                return(NotFound("Desenhista não encontrado."));
            }

            return(Ok(designer.ToDesignerApi()));
        }
Ejemplo n.º 2
0
        public async Task <Comic> ToComic(ComicUpload comicUpload)
        {
            var comic = new Comic(comicUpload);

            comic.Publisher = await _publishersRepository.GetAsync(comicUpload.SelectedPublisher);

            comicUpload.SelectedCategories.ForEach(async ci =>
            {
                var category = await _categoriesRepository.GetAsync(ci);
                comic.IncludeCategory(category);
            });

            comicUpload.SelectedAuthors.ForEach(async ai =>
            {
                var author = await _authorsRepository.GetAsync(ai);
                comic.IncludeAuthor(author);
            });

            comicUpload.SelectedDesigners.ForEach(async di =>
            {
                var designer = await _designersRepository.GetAsync(di);
                comic.IncludeDesigner(designer);
            });

            return(comic);
        }