public async Task<IActionResult> GetOwner(int id) { var owner = await Profile("Get village owner", () => ( from village in CurrentSets.Village join player in CurrentSets.Player on village.PlayerId.Value equals player.PlayerId where village.VillageId == id select player ).FirstOrDefaultAsync() ); if (owner != null) return Ok(PlayerConvert.ModelToJson(owner)); else return NotFound(); }
public async Task <IActionResult> GetMembers(int id) { var players = await( from player in CurrentSets.Player where player.TribeId.Value == id select player ).ToListAsync(); if (players.Any()) { return(Ok(players.Select(p => PlayerConvert.ModelToJson(p)))); } else { return(NotFound()); } }
public async Task <IActionResult> Get() { var players = await Paginated(CurrentSets.Player).ToListAsync(); return(Ok(players.Select(p => PlayerConvert.ModelToJson(p)))); }