From e26333ce2156d871eedd8317d7553b50931e92f5 Mon Sep 17 00:00:00 2001 From: Robert Ivanc Date: Sat, 24 Apr 2021 11:09:00 +0200 Subject: [PATCH] addpartner --- CebelcaAPISharp.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/CebelcaAPISharp.cs b/CebelcaAPISharp.cs index 412cc96..c2dd5f2 100644 --- a/CebelcaAPISharp.cs +++ b/CebelcaAPISharp.cs @@ -193,5 +193,30 @@ namespace CebelcaAPI } + public async Task AddPartner(string name, string email, string street, string city, + string postal) + { + Thread.CurrentThread.CurrentCulture = new CultureInfo("sl-SI"); + var values = new Dictionary + { + + { "name", name }, + { "email", email }, + { "street", street }, + { "city", city }, + { "postal", postal }, + + + }; + var ret = await APICall("partner", "assure", values); + var json = JArray.Parse(ret); + var retname = (json[0][0] as JObject).Properties().First().Name; + if (retname != "id") + throw new Exception("Error from api: " + ret); + var id = json[0][0]["id"].Value(); + return id; + + } + } }