public ActionResult Index() { var allPlayers = _playerRepository.GetAllPlayers().ToList().Select(player => new PlayerViewModel { SteamId = player.SteamId, NickName = player.NickName, SteamImage = player.ImagePath, Rang = player.Rang }); var model = new AppStateModel { ApiPaths = Settings.ToJson(), Icons = _strapiApi.GetAllImages()? .Select(icon => new ImageViewModel { Name = icon.CodeName, Image = icon.Image.FullUrl }).ToJson(), Weapons = _strapiApi.GetAllWeapons()? .Select(weapon => new WeaponViewModel { Id = weapon.Id, Name = weapon.Name, IconImage = weapon.Icon.FullUrl, PhotoImage = weapon.Image.FullUrl, Type = weapon.Type.Name }).ToJson(false, true), Players = allPlayers.ToJson() }; return(View(model)); }
private static List <WeaponStatModel> GetGuns(IReadOnlyCollection <Log> logs) { var weapons = _strapiApi.GetAllWeapons(); return(!logs.Any() ? new List <WeaponStatModel>() : logs.Where(x => x.Action == Actions.Kill).GroupBy(x => x.Gun).Select(r => new WeaponStatModel { Weapon = weapons.FirstOrDefault(x => x.Id == (int)r.Key), Kills = r.Count() }).OrderByDescending(x => x.Kills).ToList()); }
public void GetWeapons() { var weapons = _strapiApi.GetAllWeapons(); }