public List <GsDto> GetGsReport(RptGsInput input) { List <MST_GS> data = _gsService.GetGsByParam(input); var redata = Mapper.Map <List <GsDto> >(data); return(redata); }
public List <MST_GS> GetGsByParam(RptGsInput input) { Expression <Func <MST_GS, bool> > queryFilter = c => c.IS_ACTIVE; if (input != null) { if (input.StartDateBegin.HasValue) { queryFilter = queryFilter.And(x => x.START_DATE >= input.StartDateBegin.Value); } if (input.StartDateEnd.HasValue) { queryFilter = queryFilter.And(x => x.START_DATE <= input.StartDateEnd.Value); } if (input.EndDateBegin.HasValue) { queryFilter = queryFilter.And(x => x.END_DATE >= input.EndDateBegin.Value); } if (input.EndDateEnd.HasValue) { queryFilter = queryFilter.And(x => x.END_DATE <= input.EndDateEnd.Value); } if (!string.IsNullOrEmpty(input.VehicleUsage)) { queryFilter = queryFilter.And(x => x.VEHICLE_USAGE.ToUpper() == input.VehicleUsage.ToUpper()); } if (!string.IsNullOrEmpty(input.Location)) { queryFilter = queryFilter.And(x => input.Location.ToUpper().Contains(x.LOCATION.ToUpper())); } //queryFilter = queryFilter.And(x=> x.) } return(_gsRepository.Get(queryFilter, null, "").ToList()); }