public void ProcessContent(IContentPersister persister)
        {
            using (var db = new GameDatabaseContext())
            {
                var repo = new SkillRepository(db);
                var skills = repo.GetAll();

                foreach (var skill in skills)
                {

                    // Save out properties we want to a new object and then persist
                    dynamic persistable = new ExpandoObject();

                    Console.WriteLine("Processing skill with ID {0}", skill.Id);

                    persistable.id = skill.Id;
                    persistable.name = skill.Name;
                    persistable.castTime = skill.CastTime;
                    persistable.cooldownTime = skill.CooldownTime;
                    persistable.description = skill.Description;
                    persistable.damage = skill.Damage;
                    persistable.type = skill.SkillType;
                    persistable.iconId = skill.IconId;

                    persister.Persist(persistable, "\\skills\\{0}.json".FormatWith(skill.Id));

                }

            }
        }
Beispiel #2
0
        private void PrepareCompanyViewBag(Company company, int?n)
        {
            if (n != null)
            {
                ViewBag.N = n.Value;
            }

            ViewBag.IndustryList   = _companyRepository.GetIndustryList();
            ViewBag.IndustryIdList = _companyRepository.GetIndustryList(company.IndustryId);

            var template = GetEmailContent(company);

            ViewBag.EmailText = template;

            ViewBag.Skills = _skillRepository.GetAll().Where(x => company.CompanySkills.All(y => y.SkillId != x.Id));

            ViewBag.Message = TempData["Message"];

            var skills = db.Skills.ToList();

            skills.Insert(0, new Skill {
                Id = -1, Name = "---"
            });
            ViewBag.Skill = new SelectList(skills, "Id", "Name");
        }
 public IEnumerable<SkillTemplate> GetSkills()
 {
     using (var context = new GameDatabaseContext())
     {
         var repo = new SkillRepository(context);
         return repo.GetAll();
     }
 }
 public IActionResult GetAll()
 {
     if ((new[] { "Admin", "User", "Anonymous" }).Contains(ValidateTokenAndRole.ValidateAndGetRole(Request), StringComparer.OrdinalIgnoreCase))
     {
         IEnumerable <SkillModel> List = repo.GetAll().Select(Skill => Skill?.ToModel());
         if (List.Count() == 0)
         {
             return(NotFound());
         }
         else
         {
             return(Ok(JsonConvert.SerializeObject(List)));
         }
     }
     else
     {
         return(Unauthorized());
     }
 }
        public async Task <ActionResult> BasicData(int id)
        {
            var userManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>();
            var userId      = User.GetClaimValue(Constants.UserIdClaim);

            //if (await userManager.IsInRoleAsync(userId, Constants.AdminRole) ||
            //(int.TryParse(User.GetClaimValue(Constants.CompanyIdClaim), out int userCompanyId) && await userManager.IsInRoleAsync(userId, Constants.CompanyRole) && userCompanyId == id))
            //{
            var company     = _companyRepository.GetCompanyWithDetails(id);
            var connections = _connectionsRepository.Query().Include(nameof(Connection.Company2)).Where(x => x.CompanyId1 == id || x.CompanyId2 == id).ToList();

            int.TryParse(User.GetClaimValue(Constants.CompanyIdClaim), out var currentCompany);

            var model = new CompanyViewModel(company)
            {
                Skills = _companySkillRepository.GetSkills(company.Id),
                ApprovedConnections  = connections.Where(x => x.Status == ConnectionStatus.Approved).Select(x => x.CompanyId1 == id ? x.Company2 : x.Company1).ToList(),
                PendingConnections   = connections.Where(x => x.Status == ConnectionStatus.Requested && x.CompanyId1 == id).Select(x => x.CompanyId1 == id ? x.Company2 : x.Company1).ToList(),
                CurrentCompany       = currentCompany,
                Employees            = company.Employees,
                NotificationSettings = await _notificationSettingsRepository.GetByUserId(userId)
            };

            ViewBag.Skills = _skillRepository.GetAll()
                             .Where(x => company.CompanySkills.All(y => y.SkillId != x.Id));

            if (model.NotificationSettings == null)
            {
                model.NotificationSettings = await _notificationSettingsRepository.Add(new NotificationSettings
                {
                    UserId = userId,
                    NotificationIteration = NotificationIteration.WithoutNotification
                });
            }
            ViewBag.GoogleMapsApiKey = ConfigurationManager.AppSettings["GOOGLEMAPS_API_KEY"];

            return(View(model));
            //}
            //else
            //{
            //    return new HttpUnauthorizedResult();
            //}
        }
 // GET: Skills
 public ActionResult Index()
 {
     return(View(repo.GetAll()));
 }
Beispiel #7
0
        private void PopulateToolsetViewModel()
        {
            ClearViewModelPopulation();

            using (GameModuleRepository repo = new GameModuleRepository())
            {
                ViewModel.ActiveModule = repo.GetModule();
            }

            using (ContentPackageResourceRepository repo = new ContentPackageResourceRepository())
            {
                ViewModel.TilesetSpriteSheetsList = repo.GetAllUIObjects(ContentPackageResourceTypeEnum.Tileset, false);
            }

            using (ItemRepository repo = new ItemRepository())
            {
                ViewModel.ItemList = repo.GetAllUIObjects();
            }

            using (ScriptRepository repo = new ScriptRepository())
            {
                ViewModel.ScriptList = repo.GetAllUIObjects();
            }

            using (GenderRepository repo = new GenderRepository())
            {
                ViewModel.GenderList = repo.GetAllUIObjects();
            }

            using (ConversationRepository repo = new ConversationRepository())
            {
                ViewModel.ConversationList = repo.GetAllUIObjects();
            }

            using (RaceRepository repo = new RaceRepository())
            {
                ViewModel.RaceList = repo.GetAllUIObjects();
            }

            using (FactionRepository repo = new FactionRepository())
            {
                ViewModel.FactionList = repo.GetAllUIObjects();
            }

            using (TilesetRepository repo = new TilesetRepository())
            {
                ViewModel.TilesetList = repo.GetAllUIObjects();
            }

            using (AbilityRepository repo = new AbilityRepository())
            {
                ViewModel.AbilityList = repo.GetAll();
            }

            using (SkillRepository repo = new SkillRepository())
            {
                ViewModel.SkillList = repo.GetAll();
            }

            using (LevelRequirementRepository repo = new LevelRequirementRepository())
            {
                ViewModel.LevelRequirementList = repo.GetAll();
            }
        }