public bool CheckLoginData(string id, string password, ref ProductsClient productsClient, ref CashierClient cashierClient, ref Cashier cashier, ref List <Product> products, ref string token) { token = TokenRequester.ReuqestToken(id, password); bool result = false; if (token != null) { cashierClient = new CashierClient(token); productsClient = new ProductsClient(token); cashier = cashierClient.Login(id); products = productsClient.GetProducts(); result = true; } else { result = false; } if (cashier != null && products.Count > 0 && result) { result = true;; } else { result = false; } return(result); }
static async Task Main(string[] args) { var http = new HttpClient(); var client = new swaggerClient("http://localhost:5001", http); var products = await client.ProductsAllAsync(new ProductFilter()); foreach (var product in products) { System.Console.WriteLine(product.Name); } System.Console.WriteLine("------------"); var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var products_client = new ProductsClient(configuration); var pp = products_client.GetProducts(); foreach (var product in pp.Products) { System.Console.WriteLine(product.Name); } }
static void Main(string[] args) { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var products_client = new ProductsClient(configuration); foreach (var product in products_client.GetProducts().Products) { Console.WriteLine($"{product.Name} - {product.Price}"); } }
static void Main(string[] args) { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var product_client = new ProductsClient(configuration); Console.WriteLine("После запуска Hosting приложения нажмите любую клавишу"); Console.ReadKey(); foreach (var product in product_client.GetProducts()) { Console.WriteLine($"{product.Id} - {product.Name} - {product.Price}"); } Console.ReadLine(); }
static void Main(string[] args) { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var products_client = new ProductsClient(configuration); Console.WriteLine("К запросу готов!"); Console.ReadLine(); foreach (var product in products_client.GetProducts()) { Console.WriteLine("{0} - {1}", product.Name, product.Price); } Console.WriteLine("Запрос завершён"); Console.ReadLine(); }