public FindWarningsResponse Find(FindWarningsRequest request)
        {
            try
            {
                _warningQuery.WithOnlyActivated(true);
                _warningQuery.WithOnlyStatusActivated(request.OnlyStatusActivated);
                _warningQuery.WithOnlyStatusDeactivated(request.OnlyStatusDeactivated);
                _warningQuery.WithDisease(request.DiseaseId);
                _warningQuery.WithName(request.Name);
                _warningQuery.WithCode(request.Code);
                _warningQuery.Sort(request.Sort, request.SortBy);
                var totalRecords = _warningQuery.TotalRecords();
                _warningQuery.Paginate(request.StartPage, request.EndPage);
                var warnings = _warningQuery.Execute();

                return(new FindWarningsResponse
                {
                    Warnings = TypeAdapter.Adapt <List <WarningResponse> >(warnings),
                    TotalRecords = totalRecords
                });
            }
            catch (DataAccessException)
            {
                throw new ApplicationException();
            }
        }
Пример #2
0
 public FindWarningsResponse Get(FindWarningsRequest request)
 {
     return(_warningService.Find(request));
 }