public ActionResult <AccountReadDTO> GetAccountById(int id) { var account = _repository.GetAccountById(id); if (account != null) { return(Ok(_mapper.Map <AccountReadDTO>(account))); } return(NotFound()); }
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."));