60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using DataServer.api;
|
|
using Microsoft.Ajax.Utilities;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web.Http;
|
|
|
|
namespace JinanCementFactoryAPI.Controllers.api
|
|
{
|
|
/// <summary>
|
|
/// 回路名称
|
|
/// </summary>
|
|
public class GetLoopNameController : ApiController
|
|
{
|
|
DataServer.BLL.loop_distribution bll = new DataServer.BLL.loop_distribution();
|
|
// GET api/<controller>
|
|
public HttpResponseMessage Post([FromBody] select_loop_distribution name)
|
|
{
|
|
var res = new get_loop_name();
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(name.LoopName))
|
|
{
|
|
|
|
var list = bll.GetModelList("").Where(x=>x.LoopName==name.LoopName).ToList();
|
|
var alist = new List<loop_nameData>();
|
|
foreach (var item in list)
|
|
{
|
|
var amodel = new loop_nameData();
|
|
amodel.LoopName = item.DistributionName;
|
|
alist.Add(amodel);
|
|
}
|
|
|
|
res.code = 200;
|
|
res.msg = "成功";
|
|
res.data = alist;
|
|
}
|
|
else
|
|
{
|
|
res.code = 201;
|
|
res.msg = "参数不能为空";
|
|
}
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.code = 500;
|
|
res.msg = ex.Message;
|
|
}
|
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
|
return result;
|
|
}
|
|
}
|
|
} |