コード例 #1
0
        public async Task <ActionResult <ApiResult> > GetEureka(string servicename)
        {
            ApiResult ret = new ApiResult();

            ret.data = await _serviceProvider.GetServiceAsync(servicename);

            return(ret);
        }
コード例 #2
0
        public async Task <ApiResult> GetByID(int id)
        {
            ApiResult ret = new ApiResult();

            try
            {
                ConstructionPlan obj = await _repo.GetByID(id);

                string orgurl = await _consulclient.GetServiceAsync("EqpService");

                orgurl = orgurl + "/api/v1/Upload/ListByEntity2/" + id + "/" + (int)SystemResource.ConstructionPlan;
                string    orgret    = HttpClientHelper.GetResponse(orgurl);
                ApiResult orgretobj = JsonConvert.DeserializeObject <ApiResult>(orgret);
                if (orgretobj.data != null)
                {
                    List <UploadFileModel> jdata = new List <UploadFileModel>();
                    JArray arr = (JArray)orgretobj.data;
                    foreach (var item in arr)
                    {
                        jdata.Add(new UploadFileModel()
                        {
                            ID                 = int.Parse(item["id"].ToString()),
                            FileName           = item["fileName"].ToString(),
                            FilePath           = item["filePath"].ToString(),
                            Type               = int.Parse(item["type"].ToString()),
                            TypeName           = item["typeName"].ToString(),
                            SystemResource     = int.Parse(item["systemResource"].ToString()),
                            SystemResourceName = item["systemResourceName"].ToString(),
                            Entity             = int.Parse(item["entity"].ToString())
                        });
                    }
                    if (jdata != null)
                    {
                        obj.FileIDs = JsonConvert.SerializeObject(UploadFileCommonHelper.ListShow(jdata));
                    }
                }



                ret.data = obj;
                ret.code = Code.Success;
                return(ret);
            }
            catch (Exception ex)
            {
                ret.code = Code.Failure;
                ret.msg  = ex.Message;
                return(ret);
            }
        }