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

            if (account == null)
            {
                return(NotFound());
            }
            return(Ok(_mapper.Map <AccountReadDto>(account)));
        }
Beispiel #2
0
        public async void GetUserById(NetworkStream stream, string req1Content)
        {
            AccountModel accountModel = await _accountRepo.GetAccountById(Int32.Parse(req1Content));

            string reply = JsonSerializer.Serialize(accountModel);

            byte[] bytesWrite = Encoding.ASCII.GetBytes(reply);
            stream.Write(bytesWrite, 0, bytesWrite.Length);
        }
Beispiel #3
0
        public IActionResult GetAccount(int id)
        {
            if (!AccountExists(id))
            {
                _logger.LogWarning($"Account with id: {id} does not exist.");
                return(NotFound());
            }

            Account account = _accountRepo.GetAccountById(id);

            _logger.LogInformation($"Getting account with id: {id}");
            return(Ok(account));
        }