Esempio n. 1
0
        public FindTipsResponse Find(FindTipsRequest request)
        {
            try
            {
                _tipQuery.WithOnlyActivated(true);
                _tipQuery.WithOnlyStatusActivated(request.OnlyStatusActivated);
                _tipQuery.WithOnlyStatusDeactivated(request.OnlyStatusDeactivated);
                _tipQuery.WithName(request.Name);
                _tipQuery.Sort(request.Sort, request.SortBy);
                var totalRecords = _tipQuery.TotalRecords();
                _tipQuery.Paginate(request.StartPage, request.EndPage);
                var tips = _tipQuery.Execute();

                return(new FindTipsResponse
                {
                    Tips = TypeAdapter.Adapt <List <TipResponse> >(tips),
                    TotalRecords = totalRecords
                });
            }
            catch (DataAccessException)
            {
                throw new ApplicationException();
            }
        }
Esempio n. 2
0
 public FindTipsResponse Get(FindTipsRequest request)
 {
     return(_tipService.Find(request));
 }