Example #1
0
        public async Task <IHttpActionResult> Get()
        {
            GetLoadtestsForTimePeriodRequest  request  = new GetLoadtestsForTimePeriodRequest(DateTime.UtcNow, DateTime.UtcNow.AddDays(14));
            GetLoadtestsForTimePeriodResponse response = await _timetableService.GetLoadtestsForTimePeriodAsync(request);

            if (response.Exception == null)
            {
                return(Ok <IEnumerable <LoadTestViewModel> >(response.Loadtests));
            }

            return(InternalServerError(response.Exception));
        }
Example #2
0
        private GetLoadtestsForTimePeriodResponse GetLoadtestsForTimePeriod(GetLoadtestsForTimePeriodRequest getLoadtestsForTimePeriodRequest)
        {
            GetLoadtestsForTimePeriodResponse resp = new GetLoadtestsForTimePeriodResponse();

            try
            {
                IList <Loadtest> loadtests            = _timetableRepository.GetLoadtestsForTimePeriod(getLoadtestsForTimePeriodRequest.SearchStartDateUtc, getLoadtestsForTimePeriodRequest.SearchEndDateUtc);
                IEnumerable <LoadtestViewModel> ltVms = _timetableViewModelRepository.ConvertToViewModels(loadtests);
                resp.Loadtests = ltVms;
            }
            catch (Exception ex)
            {
                resp.Exception = ex;
            }
            return(resp);
        }