public static void Main(string[] args) { WebServiceManager <Class1> managerC1 = new WebServiceManager <Class1>("http://localhost:60984/"); WebServiceManager <Class2> managerC2 = new WebServiceManager <Class2>("http://localhost:60984/"); foreach (var item in managerC1.Get().Result) { Console.WriteLine(item); } foreach (var item in managerC2.Get().Result) { Console.WriteLine(item); } for (int i = 0; i < 5; i++) { Class1 class1 = new Class1() { Data = "c1B" + i }; managerC1.Post(class1); } Console.ReadKey(); }
private async void WebService() { WebServiceManager <ClassA> webManager = new WebServiceManager <ClassA>(DataConnectionResource.LOCALAPI); EntityGenerator <ClassA> gen = new EntityGenerator <ClassA>(); List <ClassA> classAs = gen.GenerateListItems() as List <ClassA>; await webManager.Post(classAs); var result = await webManager.Get(); }
public async void testApiConnection() { WebServiceManager <Client> webService = new WebServiceManager <Client>(DataConnectionResource.LOCALAPI); Client client1 = new Client().LoadSingleItem(); Client apiResult; //envoi enregistrer client a l'api await webService.Post(client1); //recuperation d'un client via l'id d'un client apiResult = await webService.Get(client1.Id); }
/// <summary> /// List Member Requirment by member name /// </summary> /// <param name="memberName">member name</param> /// <returns>member requirements</returns> public IList<requirement> ListMemberRequirements(string memberName) { WebServiceManager _wsManager = new WebServiceManager("http://localhost/fsllCore"); var members = _wsManager.Get("/Member/GetMember?name=" + memberName); if (members.Count > 0 && members[0]["MemberID"] != null) { return ListMemberRequirements(members[0].MemberID); } else { throw new Exception("Multiple Member Name Detected"); } }
private async void WebServiceManagerTester() { WebServiceManager <Service> servicesManager = new WebServiceManager <Service>("http://localhost:54223/api/"); List <Service> services = await servicesManager.Get(); foreach (var item in services) { Debug.WriteLine(item.ToString()); } //User user = new User() { Firstname = "jean", Lastname = "Michel", Role = new Role() { Name="role1" } }; //Debug.WriteLine(JsonConvert.SerializeObject(user)); //String json = "{\"Firstname\":\"jean\",\"Lastname\":\"Michel\",\"Role\":{\"Name\":\"role1\",\"Id\":0},\"RoleId\":0,\"Id\":0}"; //User serU = JsonConvert.DeserializeObject<User>(json); //WebServiceManager<Post> postManager = new WebServiceManager<Post>("https://jsonplaceholder.typicode.com/"); //Post post1 = await postManager.Get(1); //List<Post> posts = await postManager.Get(); //Post postPost = new Post() { body = "coucou", title = "test", userId = 1 }; //Post postPostResult = await postManager.Post(postPost); //postPostResult.title = "toto"; //await postManager.Put(postPostResult); //await postManager.Delete(postPostResult); }