Exemplo n.º 1
0
        public IHttpActionResult GetCharItems(int charId)
        {
            CharItemService charItemService = CreateCharItemService();
            var             charItems       = charItemService.GetCharItemsByCharId(charId);

            return(Ok(charItems));
        }
Exemplo n.º 2
0
        private CharItemService CreateCharItemService()

        {
            var charItemService = new CharItemService();

            return(charItemService);
        }
Exemplo n.º 3
0
        public IHttpActionResult GetItemById(int id)
        {
            ItemService     service         = CreateItemService();
            CharItemService charItemService = CreateCharItemService();
            var             item            = service.GetItemById(id);

            if (item.Name == "pbtd")
            {
                return(NotFound());
            }

            var charItemChars = charItemService.GetCharsFromCharItemList(id);    //gets list of items from CharItemService

            item.Characters = charItemChars.ToList();

            return(Ok(item));
        }
Exemplo n.º 4
0
        //Get character by CharId (returns as CharDetail)
        public IHttpActionResult Get(int charId)
        {
            //init services for queries
            CharacterService characterService = CreateCharService();
            CharItemService  charItemService  = CreateCharItemService();
            CharMediaService charMediaService = CreateCharMediaService();

            CharDetail character = characterService.GetCharById(charId); //grabs char by id and sets up new character as CharDetail

            var charItems = charItemService.GetCharItemList(charId);     //gets list of items from CharItemService

            character.Items = charItems.ToList();

            var charMedia = charMediaService.GetCharMediaList(charId);

            character.Media = charMedia.ToList();

            return(Ok(character));
        }