Example #1
0
        public ActionResult EditHero(HeroVM h)
        {
            IHeroRepo herorepo = HeroRepoFactory.Create();
            IOrgRepo  orgrepo  = OrgRepoFactory.Create();

            if (ModelState.IsValid)
            {
                h.Organizations = new List <Organization>();

                var hero = new Hero
                {
                    HeroID      = h.HeroID,
                    HeroName    = h.HeroName,
                    Description = h.Description,
                    Sightings   = h.Sightings,
                    Superpower  = h.Superpower,
                };
                foreach (var OrganizationID in h.SelectedOrganizationsID)
                {
                    hero.Organizations.Add(orgrepo.GetOrganizationById(OrganizationID));
                }
                herorepo.EditHero(hero);
            }
            return(RedirectToAction("HeroList"));
        }
Example #2
0
 public WangVM(Action onClose, Action <MobileParty> openPartyAsManage, Action openBannerEditor)
 {
     _onClose           = onClose;
     _openPartyAsManage = openPartyAsManage;
     _clan = Hero.MainHero.Clan;
     _playerUpdateTracker = PlayerUpdateTracker.Current;
     ClanMembers          = new WangClanMembersVM(RefreshCategoryValues);
     CanvassVM            = new CanvassVM(RefreshCategoryValues);
     ModSettings          = new ModSettingVM(RefreshCategoryValues);
     ClanFiefs            = new ClanFiefsVM(RefreshCategoryValues);
     SetSelectedCategory(0);
     Leader        = new HeroVM(_clan.Leader);
     CurrentRenown = (int)Clan.PlayerClan.Renown;
     CurrentTier   = Clan.PlayerClan.Tier;
     if (Campaign.Current.Models.ClanTierModel.HasUpcomingTier(Clan.PlayerClan))
     {
         NextTierRenown          = Clan.PlayerClan.RenownRequirementForNextTier;
         MinRenownForCurrentTier = Campaign.Current.Models.ClanTierModel.GetRequiredRenownForTier(CurrentTier);
         NextTier = Clan.PlayerClan.Tier + 1;
         IsRenownProgressComplete = false;
     }
     else
     {
         NextTierRenown          = 1;
         MinRenownForCurrentTier = 1;
         NextTier = 0;
         IsRenownProgressComplete = true;
     }
     RenownHint = new BasicTooltipViewModel(() => CampaignUIHelper.GetClanRenownTooltip(Clan.PlayerClan));
     UpdateBannerVisuals();
 }
Example #3
0
 public HeroVM GetHero(int id)
 {
     using (Repository repo = new Repository(new XolarDatabase()))
     {
         var    hero   = repo.GetHero(id);
         HeroVM result = new HeroVM();
         result.Id          = hero.Id;
         result.Name        = hero.Name;
         result.Rarity      = hero.Rarity.Description;
         result.ImgUrl      = hero.Picture.Source;
         result.Stars       = hero.Stars;
         result.Level       = hero.Level;
         result.Description = hero.Description;
         result.Skills      = new List <SkillVM>();
         foreach (Xolartek.Core.Fortnite.SubClass sub in repo.GetSubClass(id))
         {
             SkillVM skill = new SkillVM();
             skill.id          = sub.Id;
             skill.name        = sub.Skill.Name;
             skill.heroname    = result.Name;
             skill.classname   = sub.Name;
             skill.description = sub.Skill.Description;
             skill.issupport   = sub.IsSupport;
             skill.istactical  = sub.IsTactical;
             result.Skills.Add(skill);
         }
         return(result);
     }
 }
 public static void Postfix(HeroVM __instance, Hero hero)
 {
     if (hero != null)
     {
         __instance.IsChild = hero.Age < 3;
     }
     __instance.RefreshValues();
 }
Example #5
0
 public JsonResult Create(HeroVM hero)
 {
     try
     {
         hero = _heroAppService.Add(hero);
         return(Json(new { success = true, hero = hero }));
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, message = "Error" }));
     }
 }
Example #6
0
        public HeroVM Add(HeroVM heroVm)
        {
            var hero = Mapper.Map <HeroVM, Hero>(heroVm);

            ObjectUtils.CheckNullObj(hero);

            _uow.BeginTransaction();
            _heroService.Add(hero);

            _uow.Commit();

            return(heroVm);
        }
        public ActionResult Hero(int id)
        {
            HeroVM vm = new HeroVM();

            using (Repository repo = new Repository(new XolarDatabase()))
            {
                Xolartek.Core.Fortnite.Hero hero = repo.GetHero(id);
                vm.Id          = hero.Id;
                vm.Name        = hero.Name;
                vm.Rarity      = hero.Rarity.Description;
                vm.ImgUrl      = hero.Picture.Source;
                vm.Stars       = hero.Stars;
                vm.Level       = hero.Level;
                vm.Description = hero.Description;
            }
            return(View(vm));
        }
Example #8
0
        public ActionResult EditHero(int id)
        {
            IHeroRepo herorepo = HeroRepoFactory.Create();
            var       hero     = herorepo.GetHereosByID(id);
            var       model    = new HeroVM
            {
                HeroID      = hero.HeroID,
                HeroName    = hero.HeroName,
                Description = hero.Description,
                Superpower  = hero.Superpower,
            };

            foreach (var Org in hero.Organizations)
            {
                model.SelectedOrganizationsID.Add(Org.OrganizationID);
            }
            return(View(model));
        }
 public ActionResult LoadHeroesList([DataSourceRequest] DataSourceRequest request)
 {
     using (Repository repo = new Repository(new XolarDatabase()))
     {
         List <Hero>   heroes = repo.GetHeroes();
         List <HeroVM> result = new List <HeroVM>();
         foreach (Hero hero in heroes)
         {
             HeroVM vm = new HeroVM();
             vm.Id          = hero.Id;
             vm.Name        = hero.Name;
             vm.Rarity      = hero.Rarity.Description;
             vm.ImgUrl      = hero.Picture.Source;
             vm.Stars       = hero.Stars;
             vm.Level       = hero.Level;
             vm.Description = hero.Description;
             result.Add(vm);
         }
         return(Json(result.ToDataSourceResult(request)));
     }
 }