Esempio n. 1
0
        public async Task <ActionResult> Details(int id)
        {
            var response = await _mtgService.GetCardByMultiverseID(id);


            response.manaCost = _conversion.ConvertToSymbol(response.manaCost);

            var model = _mapper.Map <CardDto>(response);

            var UserIDString = _userManager.GetUserId(HttpContext.User);

            var userId = new Guid(UserIDString);

            var myDecks = _context.Deck.Where(x => x.UserID == userId).ToList();

            var selectList = myDecks.Select(x =>
                                            new SelectListItem()
            {
                Text  = x.Title,
                Value = x.Id.ToString()
            }).ToList();


            CardViewModel cardVM = _mapper.Map <CardViewModel>(model);

            cardVM.AddDeck(selectList);

            if (response == null)
            {
                return(NotFound());
            }

            return(View(cardVM));
        }