public async Task Set(AmuletBagViewModel inputModel)
        {
            Hero hero = await this.heroService.GetHero();

            int[] idsToSet = typeof(AmuletBagViewModel)
                             .GetProperties()
                             .Where(x => x.Name.StartsWith("On"))
                             .Select(x => (int)x.GetValue(inputModel))
                             .ToArray();

            if (idsToSet.Except(hero.Inventory.Amulets.Select(x => x.Id)).Any())
            {
                throw new FarmHeroesException(
                          this.localizationService.ExceptionLocalizer("Hero-Does-Not-Own-Amulets-Message"),
                          this.localizationService.ExceptionLocalizer("Hero-Does-Not-Own-Amulets-Instruction"),
                          Redirects.AmuletBagRedirect);
            }

            hero.AmuletBag.OnIdleAmuletId          = inputModel.OnIdleAmuletId;
            hero.AmuletBag.OnPlayerAttackAmuletId  = inputModel.OnPlayerAttackAmuletId;
            hero.AmuletBag.OnMonsterAttackAmuletId = inputModel.OnMonsterAttackAmuletId;
            hero.AmuletBag.OnFarmAmuletId          = inputModel.OnFarmAmuletId;
            hero.AmuletBag.OnMineAmuletId          = inputModel.OnMineAmuletId;
            hero.AmuletBag.OnPatrolAmuletId        = inputModel.OnPatrolAmuletId;

            await this.context.SaveChangesAsync();
        }
        public async Task <AmuletBagViewModel> GetAmuletBagViewModel()
        {
            Hero hero = await this.heroService.GetHero();

            AmuletBagViewModel viewModel = this.mapper.Map <AmuletBagViewModel>(hero.AmuletBag);

            viewModel.Amulets = this.mapper.Map <AmuletSelectViewModel[]>(hero.Inventory.Amulets);

            return(viewModel);
        }
        public async Task <IActionResult> Set(AmuletBagViewModel inputModel)
        {
            await this.amuletBagService.Set(inputModel);

            return(this.RedirectToAction("Index"));
        }
        public async Task <IActionResult> Index()
        {
            AmuletBagViewModel viewModel = await this.amuletBagService.GetAmuletBagViewModel();

            return(this.View(viewModel));
        }