public async Task <IActionResult> GetContainers() { try { var containerEntities = await _containerRepository.GetAll(); var containers = new List <Container>(); containerEntities.ForEach(containerEntity => { containers.Add(containerEntity.ToDomainModel()); }); var containerViews = new List <ContainerView>(); containers.ForEach(container => { containerViews.Add(container.ToViewModel()); }); return(new OkObjectResult(containerViews)); } catch (Exception exception) { return(new BadRequestObjectResult(exception.Message.ToString())); } }
public async Task <IActionResult> GetAllContaineres() { try { var resulta = await _container.GetAll(); return(Ok(resulta)); } catch (System.Exception) { return(this.StatusCode(StatusCodes.Status500InternalServerError, "Banco de dados Falhou")); } }
public static List <Container> GetAll() { return(repository.GetAll()); }