コード例 #1
0
        public IHttpActionResult AddTransaction(int bId, int biId, int ttId, string createdById, float amount, string transactionDateTime, string memo)
        {
            try
            {
                Guid createdByGuid = new Guid(createdById);
            }
            catch (FormatException e)
            {
                return(BadRequest($"Invalid Value for createdById: '{createdById}'"));
            }
            var      amountDecResult           = Convert.ToDecimal(Math.Round(amount, 2));
            DateTime transactionDateTimeParsed = DateTime.Parse(transactionDateTime);

            var transaction = new Transaction
            {
                BankAccountId       = bId,
                BudgetItemId        = biId,
                TransactionTypeId   = ttId,
                CreatedById         = createdById,
                Amount              = amountDecResult,
                TransactionDateTime = transactionDateTimeParsed,
                Memo = memo
            };

            return(Ok(_db.AddTransaction(transaction)));
        }
コード例 #2
0
 public IHttpActionResult AddTransaction(int bankAccId, int budgetItemId, string ownerId, TransactionType transType, float amount, string memo)
 {
     return(Ok(db.AddTransaction(bankAccId, budgetItemId, ownerId, transType, amount, memo)));
 }