public async Task<Supplier> SaveAsync(Supplier supplier) { var url = string.Format("Supplier/Save?apikey={0}&companyid={1}", _apiKey, _companyId); var request = new RestRequest(url, Method.POST) { JsonSerializer = new JsonSerializer() }; request.RequestFormat = DataFormat.Json; request.AddBody(supplier); var response = await _client.ExecuteTaskAsync<Supplier>(request); StatusDescription = response.StatusDescription; StatusCode = response.StatusCode; return response.Data; }
public void Save() { var supplier = new Supplier { Name = "New Orleans Cajun Delights", ContactName = "Shelley Burke", DeliveryAddress01 = "P.O. Box 78934", DeliveryAddress02 = "New Orleans", DeliveryAddress03 = "LA", DeliveryAddress04 = "70117", DeliveryAddress05 = "USA", PostalAddress01 = "P.O. Box 78934", PostalAddress02 = "New Orleans", PostalAddress03 = "LA", PostalAddress04 = "70117", PostalAddress05 = "USA", Telephone = "(100) 555-4822", Active = true }; Api.SupplierRequest.Save(supplier); }