DongYing/DongYingAPI/Controllers/api/EnergyEfficiency/GetDeviceOperationControlle...

43 lines
1.2 KiB
C#

using DataServer.api.EnergyEfficiency;
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 DongYingAPI.Controllers.api.EnergyEfficiency
{
/// <summary>
/// 获取设备运行情况接口
/// </summary>
public class GetDeviceOperationController : ApiController
{
DataServer.BLL.device_operation bll = new DataServer.BLL.device_operation();
/// <summary>
/// 获取设备运行情况接口
/// </summary>
/// <returns></returns>
public HttpResponseMessage Get()
{
var res = new get_device_operation_response();
try
{
res.code = 200;
res.msg = "成功";
res.data = bll.GetModelList("");
}
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;
}
}
}