/// <summary>
        /// mapping back the view model,
        /// when something goes wrong
        /// </summary>
        /// <returns></returns>
        internal static ChooseHeroesViewModel Mapping(List <FavouriteSuperHero> favSuperHeroList)
        {
            //mapping back
            var model = new ChooseHeroesViewModel();

            model.UserHeroList     = favSuperHeroList;
            model.OpponentHeroList = favSuperHeroList;

            return(model);
        }
        // GET: ChooseHeroView
        public ActionResult ChooseHero()
        {
            var model  = new ChooseHeroesViewModel();
            var userId = User.Identity.GetUserId();

            try
            {
                var userFavSuperHeroesList = objBs.FavouriteSuperHeroBLL.GetUserFavouriteSuperHeroList(userId);
                model            = objBs.chooseHeroBLL.Mapping(userFavSuperHeroesList);
                ViewBag.HeroList = userFavSuperHeroesList;

                return(View());
            }
            catch (Exception)
            {
                throw;
            }
        }
        public ActionResult ChooseHero(ChooseHeroesViewModel model)
        {
            try
            {
                var rnd    = new Random();
                var heroId = model.UserHeroApiIdList.FirstOrDefault();
                var oppId  = model.OpponentHeroApiIdList.FirstOrDefault();

                //the user choosed a random enemy hero
                if (oppId == 0)
                {
                    oppId = rnd.Next(1, 733);
                    return(RedirectToAction("BattleRandom", "Battle", new { leftHeroApiId = heroId, rightHeroApiId = oppId }));
                }

                return(RedirectToAction("Battle", "Battle", new { leftHeroApiId = heroId, rightHeroApiId = oppId }));
            }
            catch (Exception)
            {
                throw;
            }
        }