// Create Item + status of API call // P.S. Authorization needed public async Task CreateItem(ItemCreate item) { Tuple <HttpStatusCode, Error> responce; try { // Login user await Login(); // If Login successfull, go on and create item if (LoginAPICallStatus == HttpStatusCode.OK) { // Wrap item with root element (for JSON formating during serialization) RootObjectItemCreate rootObjectItemCreate = new RootObjectItemCreate(item); responce = await IDMToolsAsync.CreateItemAsync(rootObjectItemCreate); // Get responce values CreateItemAPICallStatus = responce.Item1; CreateItemAPICallResponceError = responce.Item2; } // If not... do whatever you want, just not cry... take a candy ;) else { } } catch (Exception) { // handle Exception here throw; } finally { // Logout user await Logout(); } }
public RootObjectItemCreate(ItemCreate item) : base() { this.item = item; }