public ActionResult <IEnumerable <EnvironmentDTO> > GetEnvironments() { var service = _environmentRepository.GetAll(); if (service.Count == 0) { return(NotFound()); } return(Ok(_mapper.Map <IEnumerable <EnvironmentDTO> >(service))); }
public ObjectResult GetAll() { try { List <Domain.Models.Environment> environments = _repository.GetAll(); var environmentsDTOs = _mapper.Map <List <EnvironmentViewDTO> >(environments); return(Ok(environmentsDTOs)); } catch (Exception ex) { return(StatusCode(500, $"Ocorreu um erro inesperado: {ex.Message}")); } }
/// <summary> /// Find first environment by name /// </summary> /// <param name="environments">The environment repository</param> /// <param name="environment">The environment name</param> /// <returns>Environment object or null</returns> public static Environment GetEnvironment(this IEnvironmentRepository environments, string environment) { var result = environments .GetAll() .Select(x => new DeploymentPlanner.Environment() { Id = x.Id, Name = x.Name }) .FirstOrDefault(x => x.Name == environment); if (result == null) { throw new Exception(string.Format("Can't find environment name of {0}", environment)); } return(result); }
public List <SystemEnvironment> GetAll() { return(_environmentRepository.GetAll()); }
public async Task <IEnumerable <Environment> > GetAll(string featureName) { return(await environmentRepository.GetAll(featureName)); }