48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using DataServer.api;
|
|
using Microsoft.Ajax.Utilities;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
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 Get()
|
|
{
|
|
var res = new get_loop_name();
|
|
try
|
|
{
|
|
var list = bll.GetModelList("");
|
|
var alist = new List<loop_nameData>();
|
|
foreach (var item in list.DistinctBy(x=>x.LoopName))
|
|
{
|
|
var model = new loop_nameData();
|
|
model.LoopName=item.LoopName;
|
|
alist.Add(model);
|
|
}
|
|
|
|
res.code = 200;
|
|
res.msg = "成功";
|
|
res.data = alist;
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
} |