93 lines
2.6 KiB
C#
93 lines
2.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Web.Http;
|
|
using BLL;
|
|
using Mvc.Controllers;
|
|
|
|
namespace WebAPI.Controllers.HSSE
|
|
{
|
|
/// <summary>
|
|
/// 违规人员记录控制器
|
|
/// </summary>
|
|
public class ViolationPersonController : ApiController
|
|
{
|
|
#region 列表
|
|
/// <summary>
|
|
/// 列表
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getList(string projectId, int pageIndex = 0)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getDataList = ViolationPersonService.getList(projectId);
|
|
int pageCount = getDataList.Count();
|
|
if (pageCount > 0 && pageIndex > 0)
|
|
{
|
|
getDataList = getDataList.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
|
|
}
|
|
responeData.data = new { pageCount, getDataList };
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
|
|
#region 查询明细
|
|
/// <summary>
|
|
/// 查询明细
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getDetail(string Id)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
responeData.data = ViolationPersonService.getDetail(Id);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public Model.ResponeData SaveOrEdit([FromBody] Model.ViolationPersonItem model)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
responeData.message = ViolationPersonService.SaveOrEdit(model);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
}
|
|
} |