Exemple #1
0
        public async Task GetTestAsync()
        {
            var internamento = await business.GetByIdAsync(
                1,
                CancellationToken.None
                );

            Assert.AreEqual(internamento.Id_Doente, 12345);
        }
        public async Task <DataBase.ViewModels.Internamento> GetByIdAsync(
            [FromRoute] int id,
            CancellationToken ct
            )
        {
            var result = await _internamentoServices.GetByIdAsync(id, ct);

            var doente = await _doenteServices.GetByIdAsync(result.Id_Doente, ct);

            var hospital = await _hospitalServices.GetByIdAsync(result.Id_Hospital, ct);

            var utilizador = await _utilizadorServices.GetByIdAsync(doente.Id_Utilizador, ct);

            return(result.ToViewModel(utilizador, hospital));
        }