Exemplo n.º 1
0
        public async Task <IActionResult> GetVillages(int id)
        {
            var villages = await Paginated(
                from village in CurrentSets.Village
                where village.PlayerId.Value == id
                select village
                ).ToListAsync();

            if (villages.Any())
            {
                return(Ok(villages.Select(v => VillageConvert.ModelToJson(v))));
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetVillages(int id)
        {
            var villages = await Profile("GetTribeVillages", () => Paginated (
                                             from player in CurrentSets.Player
                                             where player.TribeId.HasValue && player.TribeId.Value == id
                                             join village in CurrentSets.Village on player.PlayerId equals village.PlayerId.Value
                                             select village
                                             ).ToListAsync()
                                         );

            if (villages.Any())
            {
                return(Ok(villages.Select(v => VillageConvert.ModelToJson(v))));
            }
            else
            {
                return(NotFound());
            }
        }