Beispiel #1
0
 //[GzipCompression]
 public async Task <HttpResponseMessage> Search(SearchDespesasViewModel searchViewModel)
 {
     if (searchViewModel == null)
     {
         var result   = _despesasApp.GetDespesas();
         var response = Request.CreateResponse(HttpStatusCode.OK, result);
         var tsc      = new TaskCompletionSource <HttpResponseMessage>();
         tsc.SetResult(response);
         return(await tsc.Task);
     }
     else
     {
         var result   = _despesasApp.SearchDespesas(searchViewModel);
         var response = Request.CreateResponse(HttpStatusCode.OK, result);
         var tsc      = new TaskCompletionSource <HttpResponseMessage>();
         tsc.SetResult(response);
         return(await tsc.Task);
     }
 }
Beispiel #2
0
        public IEnumerable <DespesasViewModel> SearchDespesas(SearchDespesasViewModel searchViewModel)
        {
            var search = Mapper.Map <SearchDespesasViewModel, SearchDespesa>(searchViewModel);

            return(Mapper.Map <IEnumerable <Despesas>, IEnumerable <DespesasViewModel> >(_despesasService.SearchDespesas(search)));
        }