Ejemplo n.º 1
0
        private static void ListAllUsers(IUserLogic userLogic, IAwardLogic awardLogic)
        {
            try
            {
                foreach (var user in userLogic.GetAllUsers())
                {
                    string strId = $"{user.Id}.";
                    string strName = $" Name: \"{user.Name}\"";
                    string strDate = $" BirthDay: \"{user.BirthDay.ToShortDateString()}\"";
                    string strAge = $" Age: \"{userLogic.GetAge(user.BirthDay)}\"";

                    Console.WriteLine(strId + strName + strDate + strAge);

                    foreach (var award in awardLogic.GetAwardsByUserId(user.Id))
                    {
                        Console.WriteLine($"\tHas award: \"{award.Title}\"");
                    }

                    Console.WriteLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine();
        }