Exemplo n.º 1
0
        public async Task <IActionResult> GetAll()
        {
            var prtyList = await _partyRepository.GetAllPartyAsync();

            foreach (var party in prtyList)
            {
                party.CleanChildEntites();
            }

            var allParties = (
                from prty in prtyList
                select prty into party
                where party != null && (!party.deprecationTime.HasValue || party.deprecationTime.Value > DateTime.UtcNow)
                select BsonSerializer.Deserialize <Party>(party.ToBsonDocument()) into prt
                select new Dictionary <string, string> {
                { "id", "\"" + prt.id + "\"" }, { "Party", prt.ToJson() }
            }
                ).ToList();

            var permitJson = new JsonStringResult(allParties);

            return(permitJson);
        }