Exemple #1
0
        public ActionResult <AccountReadDTO> GetAccountById(int id)
        {
            var account = _repository.GetAccountById(id);

            if (account != null)
            {
                return(Ok(_mapper.Map <AccountReadDTO>(account)));
            }
            return(NotFound());
        }
Exemple #2
0
        public ActionResult <TransferCreateDTO> MakeTransfer(TransferCreateDTO transferCreateDTO)
        {
            var transferModel = _mapper.Map <Transfer>(transferCreateDTO);
            var senderModel   = _accountRepo.GetAccountById(transferModel.SenderID);
            var receiverModel = _accountRepo.GetAccountById(transferModel.ReceiverID);

            transferModel.Amount = Math.Round(transferModel.Amount, 2);

            if (senderModel == null)
            {
                return(Problem("Sender doesn't exist.", default, 400, "Bad transfer request."));