コード例 #1
0
        public async Task <IActionResult> GetHealthCheck()
        {
            try
            {
                var result = await _launchPadRepo.Get();

                return(Ok("Ok, ready to launch!"));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError, ex));
            }
        }
コード例 #2
0
        public async Task <IEnumerable <Launchpad> > Get(string status, string nameContains)
        {
            //Simple implementation following YAGNI. As filter becomes more complex, maybe a filter that dynamically builds predicates using expressions
            //If capturing domain logic matching then move check to domain and perhaps use specification pattern.

            var results = await _launchPadRepository.Get();

            if (!String.IsNullOrWhiteSpace(status))
            {
                results = results.Where(x => x.Status == status);
            }

            if (!String.IsNullOrWhiteSpace(nameContains))
            {
                results = results.Where(x => x.Name.Contains(nameContains));
            }

            return(results);
        }
コード例 #3
0
ファイル: LaunchpadService.cs プロジェクト: chadit/spacex
 public async Task <IList <Launchpad> > Get(int?limit, int?offset)
 {
     return(await _launchpadRepository.Get(limit, offset));
 }