Пример #1
0
        /// <summary>
        /// Creates a new expense category under the authenticated account. Makes a POST and a GET request to the Expense_Categories resource.
        /// </summary>
        /// <param name="options">The options for the new expense category to be created</param>
        public ExpenseCategory CreateExpenseCategory(ExpenseCategoryOptions options)
        {
            var request = Request("expense_categories", RestSharp.Method.POST);

            request.AddBody(options);

            return Execute<ExpenseCategory>(request);
        }
Пример #2
0
        /// <summary>
        /// Creates a new expense category under the authenticated account. Makes both a POST and a GET request to the Expense_Categories resource.
        /// </summary>
        /// <param name="name">The name of the expense category</param>
        /// <param name="unitName">The unit name of the expense category (Unit name and price must be set together)</param>
        /// <param name="unitPrice">The unit price of the expense category (Unit name and price must be set together)</param>
        public ExpenseCategory CreateExpenseCategory(string name, string unitName = null, decimal? unitPrice = null)
        {
            if (name == null)
                throw new ArgumentNullException("name");

            var newExpenseCategory = new ExpenseCategoryOptions()
            {
                Name = name,
                UnitName = unitName,
                UnitPrice = unitPrice
            };

            return CreateExpenseCategory(newExpenseCategory);
        }
Пример #3
0
        /// <summary>
        /// Update a expense category on the authenticated account. Makes a PUT and a GET request to the Expense_Category resource.
        /// </summary>
        /// <param name="expenseCategoryId">The ID of the expense category to update</param>
        /// <param name="name">The updated name</param>
        /// <param name="unitName">The updated unit name (Unit name and price must be set together)</param>
        /// <param name="unitPrice">The updated unit price (Unit name and price must be set together)</param>
        public ExpenseCategory UpdateExpenseCategory(long expenseCategoryId, string name = null, string unitName = null, decimal? unitPrice = null)
        {
            var options = new ExpenseCategoryOptions()
            {
                Name = name,
                UnitName = unitName,
                UnitPrice = unitPrice
            };

            return UpdateExpenseCategory(expenseCategoryId, options);
        }
Пример #4
0
        /// <summary>
        /// Updates an expense category on the authenticated account. Makes a PUT and a GET request to the Expense_Category resource.
        /// </summary>
        /// <param name="expenseCategoryId">The ID for the expense category to update</param>
        /// <param name="options">The options to be updated</param>
        public ExpenseCategory UpdateExpenseCategory(long expenseCategoryId, ExpenseCategoryOptions options)
        {
            var request = Request("expense_categories/" + expenseCategoryId, RestSharp.Method.PUT);

            request.AddBody(options);

            return Execute<ExpenseCategory>(request);
        }