public ActionResult <List <ComicBook> > LocalComicSearch(string searchTerm = "")
        {
            List <ComicBook> searchResponseList = new List <ComicBook>();

            searchResponseList = comicDAO.LocalComicSearch(searchTerm);
            foreach (ComicBook comic in searchResponseList)
            {
                comic.Characters = characterDAO.GetCharacterListForComicBook(comic.Id);
                comic.Creators   = creatorDAO.GetComicCreators(comic.Id);
                comic.Volume     = volumeDAO.GetComicVolume(comic.Id);
                comic.Tags       = tagDAO.GetTagListForComicBook(comic.Id);
            }
            return(Ok(searchResponseList));
        }
示例#2
0
 public ActionResult <List <ComicBook> > ComicsInCollection(int id)
 {
     if (VerifyActiveUserOwnsCollection(id))
     {
         List <ComicBook> comicsInCollection = comicDAO.ComicsInCollection(id);
         foreach (ComicBook comic in comicsInCollection)
         {
             comic.Characters = characterDAO.GetCharacterListForComicBook(comic.Id);
             comic.Creators   = creatorDAO.GetComicCreators(comic.Id);
             comic.Tags       = tagDAO.GetTagListForComicBook(comic.Id);
             comic.Volume     = volumeDAO.GetComicVolume(comic.Id);
         }
         return(Ok(comicsInCollection));
     }
     else
     {
         return(Unauthorized(new { message = "Not owner of collection" }));
     }
 }
        public ActionResult <List <ComicBook> > ComicsInPublicCollection(int id)
        {
            Collection collection = collectionDAO.GetSingleCollection(id);

            if (collection.Public)
            {
                List <ComicBook> publicViewComics = comicDAO.ComicsInCollection(id);
                foreach (ComicBook comic in publicViewComics)
                {
                    comic.Characters = characterDAO.GetCharacterListForComicBook(comic.Id);
                    comic.Creators   = creatorDAO.GetComicCreators(comic.Id);
                    comic.Volume     = volumeDAO.GetComicVolume(comic.Id);
                    comic.Tags       = tagDAO.GetTagListForComicBook(comic.Id);
                }
                return(Ok(publicViewComics));
            }
            else
            {
                return(Unauthorized(new { message = "This collection is private" }));
            }
        }