using Model;
using Model.HJGL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace WebAPI.Controllers.HJGL
{
///
///
///
public class PersonEntranceController : ApiController
{
///
///
///
///
///
///
///
[HttpGet]
public ResponseData> Index(string projectId, string name, int pageIndex)
{
ResponseData> res = new ResponseData>();
try
{if (string.IsNullOrEmpty(name))
name = "";
res.successful = true;
res.resultValue = BLL.APIWelderEntranceService.GetWelderList(projectId, name, pageIndex);
}
catch (Exception e)
{
res.successful = false;
}
return res;
}
[HttpGet]
public ResponseData GetWelderById(string welderId)
{
ResponseData res = new ResponseData();
try
{
res.successful = true;
res.resultValue = BLL.APIWelderEntranceService.GetWelderById(welderId);
}
catch (Exception e)
{
res.successful = false;
}
return res;
}
[HttpGet]
public ResponseData IsExistWEDName(string WED_Name, string projectId)
{
ResponseData res = new ResponseData();
try
{
res.successful = true;
res.resultValue = BLL.APIWelderEntranceService.IsExistWEDName( WED_Name, projectId);
}
catch (Exception e)
{
res.successful = false;
}
return res;
}
[HttpGet]
public ResponseData IsExistWEDCode(string WED_Code, string projectId)
{
ResponseData res = new ResponseData();
try
{
res.successful = true;
res.resultValue = BLL.APIWelderEntranceService.IsExistWEDCode(WED_Code, projectId);
}
catch (Exception e)
{
res.successful = false;
}
return res;
}
[HttpGet]
public ResponseData DeleteBSWelder(string WED_ID)
{
ResponseData res = new ResponseData();
try
{
res.successful = true;
BLL.APIWelderEntranceService.DeleteBSWelder(WED_ID);
}
catch (Exception e)
{
res.successful = false;
}
return res;
}
[HttpPost]
public ResponseData Add([FromBody]WelderEntrance welder)
{
ResponseData res = new ResponseData();
try
{
res.successful = true;
BLL.APIWelderEntranceService.AddBSWelder(welder);
}
catch (Exception e)
{
res.successful = false;
}
return res;
}
[HttpPost]
public ResponseData update([FromBody]WelderEntrance welder)
{
ResponseData res = new ResponseData();
try
{
res.successful = true;
BLL.APIWelderEntranceService.UpdateBSWelder(welder);
}
catch (Exception e)
{
res.successful = false;
}
return res;
}
}
}