public ServiceResponse <IQueryable <Testimonial> > GetAll(FilterReq req) { try { var qry = _repository.TableNoTracking; if (!string.IsNullOrWhiteSpace(req.Filter)) { qry = qry.Where(p => p.Title.Contains(req.Filter)); } return(new ServiceResponse <IQueryable <Testimonial> >(true) { Data = qry, Messages = new List <Messages> { AppMessages.DataRetrievedSuccessfully } }); } catch (Exception ex) { _logger.LogError(ex.ToExceptionMessage()?.Message); return(new ServiceResponse <IQueryable <Testimonial> >(false, new List <Messages> { AppMessages.TechincalProblemOccured }, MessageType.Danger)); } }
public ActionResult QueryKycInfos([FromQuery] FilterReq filterReq) { try { var reply = Client.QueryKycInfos(filterReq); return(Json(new JsonResultModel(ReturnCode.Success, "Query successful.", reply))); } catch (RpcException ex) { return(Json(new JsonResultModel(ReturnCode.QueryError, ex.Status.Detail))); } }
public IActionResult Index(FilterReq pModel) { _logger.LogInformation("Index Executing.."); var dtoList = new List <TestimonialDto>(); var serviceResult = _service.GetAll(pModel); if (!serviceResult.Status) { return(Okay(serviceResult)); } foreach (var testimonial in serviceResult.Data) { var dto = _mapper.Map <Testimonial, TestimonialDto>(testimonial); dtoList.Add(dto); } return(Okay(new ServiceResponse <List <TestimonialDto> >(true) { Data = dtoList })); }