public GetParaBhTypeResponse GetParaBhType(GetParaBhTypeRequest request, IEnumerable <KeyValuePair <string, string> > pairs) { var response = new GetParaBhTypeResponse(); //参数校验 IBxAgent agentModel = GetAgentModelFactory(request.Agent); if (!agentModel.AgentCanUse()) { response.Status = HttpStatusCode.Forbidden; return(response); } if (!ValidateReqest(pairs, agentModel.SecretKey, request.SecCode)) { response.Status = HttpStatusCode.Forbidden; return(response); } var list = _paraBhTypeRepository.GetListByTypeId(request.TypeId, request.IsAll); if (list.Count > 0) { response.Total = list.Count; response.ParaBhTypeList = list; } else { response.ErrCode = -1; } return(response); }
public HttpResponseMessage GetParaBhType([FromUri] GetParaBhTypeRequest request) { _logInfo.Info(string.Format("获取枚举类型接口请求串:{0}", Request.RequestUri)); var viewModel = new GetParaBhTypeViewModel(); if (!ModelState.IsValid) { viewModel.BusinessStatus = -10000; string msg = ModelState.Values.Where(item => item.Errors.Count == 1).Aggregate(string.Empty, (current, item) => current + (item.Errors[0].ErrorMessage + "; ")); viewModel.StatusMessage = "输入参数错误," + msg; return(viewModel.ResponseToJson()); } var response = _enumService.GetParaBhType(request, Request.GetQueryNameValuePairs()); _logInfo.Info("获取枚举类型接口返回值" + response.ToJson()); if (response.Status == HttpStatusCode.BadRequest || response.Status == HttpStatusCode.Forbidden) { viewModel.BusinessStatus = -10001; viewModel.StatusMessage = "参数校验错误,请检查您的校验码"; return(viewModel.ResponseToJson()); } if (response.Status == HttpStatusCode.ExpectationFailed) { viewModel.BusinessStatus = -10003; viewModel.StatusMessage = "服务发生异常"; return(viewModel.ResponseToJson()); } if (response.ErrCode == -1) { viewModel.BusinessStatus = -1; viewModel.StatusMessage = "无枚举类型"; } else { viewModel.BusinessStatus = 1; viewModel.StatusMessage = "获取成功"; viewModel.ParaBhType = response.ParaBhTypeList.ConvertToViewModel(); } return(viewModel.ResponseToJson()); }