示例#1
0
        public async Task <ErrorCodeLib.Models.ResultModel> GET([FromQuery] ExpenditureModelForQuery model)
        {
            var result = new ErrorCodeLib.Models.ResultModel();

            var predicate = PredicateBuilder.True <ExpenditureModel>();

            if (model.partner_id != null)
            {
                predicate = predicate.And(a => a.partner_id == model.partner_id);
            }
            if (model.project_id != null)
            {
                predicate = predicate.And(a => a.project_id == model.project_id);
            }
            if (model.date_start != null)
            {
                predicate = predicate.And(a => a.project_.date_start >= model.date_start);
            }
            if (model.date_end != null)
            {
                predicate = predicate.And(a => a.project_.date_end <= model.date_end);
            }

            var query_result = _repo_expenditure.FindAll(predicate);

            result = ErrorCode.SUCCESS(query_result, "", "cht");
            return(result);
        }