diff --git a/Sources/ConsoleApplication/ConsoleApplication.csproj b/Sources/ConsoleApplication/ConsoleApplication.csproj new file mode 100644 index 0000000..3e93ad0 --- /dev/null +++ b/Sources/ConsoleApplication/ConsoleApplication.csproj @@ -0,0 +1,15 @@ + + + + Exe + net6.0 + enable + enable + + + + + + + + diff --git a/Sources/ConsoleApplication/Program.cs b/Sources/ConsoleApplication/Program.cs new file mode 100644 index 0000000..d3916f1 --- /dev/null +++ b/Sources/ConsoleApplication/Program.cs @@ -0,0 +1,44 @@ + +using ConsoleApplication; +using EntityFramework; +using HttpClient; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Model; + +var builder = WebApplication.CreateBuilder(); + +builder.Services.AddDbContext(); + +var app = builder.Build(); + +using (var scope = app.Services.CreateScope()) +{ + var context = scope.ServiceProvider.GetService(); + context.Database.EnsureCreated(); +} + +IDataManager dataManager = new HttpClientManager(); + +string choice = "0"; + +while (choice != "9") +{ + Utils.showMainMenu(); + choice = Console.ReadLine(); + + switch (choice) + { + case "1": + { + Utils.championMenu(dataManager.ChampionsMgr); + break; + } + case "2": + { + //Utils. + break; + } + + } +} \ No newline at end of file diff --git a/Sources/ConsoleApplication/Utils.cs b/Sources/ConsoleApplication/Utils.cs new file mode 100644 index 0000000..fb70443 --- /dev/null +++ b/Sources/ConsoleApplication/Utils.cs @@ -0,0 +1,55 @@ +using Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConsoleApplication +{ + public static class Utils + { + public static void showMainMenu() + { + Console.WriteLine("-------- Menu -------"); + Console.WriteLine(" 1 - Champions "); + Console.WriteLine(" 2 - Skills "); + Console.WriteLine("\n 9 - Quitter"); + } + + public static void showChampionMenu() + { + Console.WriteLine("-------- Champion -------"); + Console.WriteLine(" 1 - Count "); + Console.WriteLine(" 2 - Default "); + Console.WriteLine("\n 9 - Quitter"); + } + + public static async void championMenu(IChampionsManager championsManager ) { + string choix = "0"; + + while (choix != "9") + { + Utils.showChampionMenu(); + choix = Console.ReadLine(); + + switch (choix) + { + case "1": + //Console.WriteLine("# result : "+ await championsManager.GetNbItems()); + break; + case "2": + var list = await championsManager.GetItems(0, 10); + foreach(var cham in list) + { + Console.WriteLine("# result : " +cham.ToString()); + + } + break; + } + } + } + + + } +}