public PersonWithDebt RetriveClientWithBankStats(int personId)
        {
            var personFromDB = _repo.AllPersons().Result.Where(p => p.IDPerson == personId).FirstOrDefault();

            var person = new PersonWithDebt()
            {
                PersonId   = personFromDB.IDPerson,
                PersonName = personFromDB.Name,
                Debts      = new List <Debt>()
            };

            var debts = _repo.DebtsForPeopleAndBanks().Result.Where(p => p.person.IDPerson == personId);

            person.Debts.AddRange(debts);

            return(person);
        }
Example #2
0
        static void Main(string[] args)
        {
            var d = new DebtRepository();

            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(d.AllBanks()));
            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(d.AllPersons()));
            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(d.DebtsForPeopleAndBanks()));
        }