Inheritance: BaseModel
コード例 #1
0
        public Category Save(Category category, Enums.CategoryType categoryType)
        {
            if (categoryType == Enums.CategoryType.Account)
            {
                throw new NotSupportedException("Account Category Save is not supported by the API.");
            }

            var url = string.Format("{0}Category/Save?apikey={1}&companyid={2}", categoryType, _apiKey, _companyId);
            var request = new RestRequest(url, Method.POST) { JsonSerializer = new JsonSerializer() };
            request.RequestFormat = DataFormat.Json;
            request.AddBody(category);
            var response = _client.Execute<Category>(request);
            return response.Data;
        }
コード例 #2
0
 public void Save_SupplierCategory()
 {
     var category = new Category();
     category.Description = "Supplier Category - Test";
     var newCategory = Api.CategoryRequest.Save(category, Enums.CategoryType.Supplier);
 }
コード例 #3
0
 public void Save_ItemCategory()
 {
     var itemCategory = new Category();
     itemCategory.Description = "Accessories";
     var newCategory = Api.CategoryRequest.Save(itemCategory, Enums.CategoryType.Item);
 }
コード例 #4
0
 public void Save_CustomerCategory()
 {
     var itemCategory = new Category();
     itemCategory.Description = "Customer Category Test";
     var newCategory = Api.CategoryRequest.Save(itemCategory, Enums.CategoryType.Customer);
 }
コード例 #5
0
 public void Save_BankAccountCategory()
 {
     var itemCategory = new Category();
     itemCategory.Description = "BankAccount Category Test";
     var newCategory = Api.CategoryRequest.Save(itemCategory, Enums.CategoryType.BankAccount);
 }
コード例 #6
0
 public void Save_AssetCategory()
 {
     var itemCategory = new Category();
     itemCategory.Description = "Asset Category Test";
     var newCategory = Api.CategoryRequest.Save(itemCategory, Enums.CategoryType.Asset);
 }