Exemplo n.º 1
0
        public IActionResult Deposit(Transaction transaction)
        {
            if (ModelState.IsValid)
            {
                transaction.TranDate = DateTime.Now;
                _tranContext.CreateTransaction(transaction);
                return(RedirectToAction("Details", "BankAccount", new { AccountNum = transaction.TranAccountId }));
            }

            return(View(transaction));
        }
Exemplo n.º 2
0
        private void UpdateTransactionAndBalance(Spin spin, string userId)
        {
            var t = _transactionRepo.CreateTransaction(
                new TransactionBindingModel
            {
                TransactionDate = DateTime.Now,
                Type            = TransactionType.FromSpin,
                Value           = spin.ResultValue
            }, userId);

            _balanceRepo.UpdateBalance(t.Value, userId);
        }
Exemplo n.º 3
0
        public ActionResult <TransactionReadDto> PostTodoItem(TransactionCreateDto transactionCreateDto)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var transactionModel = _mapper.Map <Transaction>(transactionCreateDto);

            _repository.CreateTransaction(transactionModel);
            _repository.SaveChanges();

            var transactionReadDto = _mapper.Map <TransactionReadDto>(transactionModel);

            return(CreatedAtRoute(nameof(GetTransactionById), new { Id = transactionReadDto.Id }, transactionReadDto));
        }
Exemplo n.º 4
0
 public Transaction CreateTransaction(Transaction transaction)
 {
     return(_transactionRepo.CreateTransaction(transaction));
 }