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 { /// <summary> /// /// </summary> public class PersonEntranceController : ApiController { /// <summary> /// /// </summary> /// <param name="projectId"></param> /// <param name="name"></param> /// <param name="pageIndex"></param> /// <returns></returns> [HttpGet] public ResponseData<List<WelderEntrance>> Index(string projectId, string name, int pageIndex) { ResponseData<List<WelderEntrance>> res = new ResponseData<List<WelderEntrance>>(); 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<WelderEntrance> GetWelderById(string welderId) { ResponseData<WelderEntrance> res = new ResponseData<WelderEntrance>(); try { res.successful = true; res.resultValue = BLL.APIWelderEntranceService.GetWelderById(welderId); } catch (Exception e) { res.successful = false; } return res; } [HttpGet] public ResponseData<bool> IsExistWEDName(string WED_Name, string projectId) { ResponseData<bool> res = new ResponseData<bool>(); try { res.successful = true; res.resultValue = BLL.APIWelderEntranceService.IsExistWEDName( WED_Name, projectId); } catch (Exception e) { res.successful = false; } return res; } [HttpGet] public ResponseData<bool> IsExistWEDCode(string WED_Code, string projectId) { ResponseData<bool> res = new ResponseData<bool>(); try { res.successful = true; res.resultValue = BLL.APIWelderEntranceService.IsExistWEDCode(WED_Code, projectId); } catch (Exception e) { res.successful = false; } return res; } [HttpGet] public ResponseData<bool> DeleteBSWelder(string WED_ID) { ResponseData<bool> res = new ResponseData<bool>(); try { res.successful = true; BLL.APIWelderEntranceService.DeleteBSWelder(WED_ID); } catch (Exception e) { res.successful = false; } return res; } [HttpPost] public ResponseData<string> Add([FromBody]WelderEntrance welder) { ResponseData<string> res = new ResponseData<string>(); try { res.successful = true; BLL.APIWelderEntranceService.AddBSWelder(welder); } catch (Exception e) { res.successful = false; } return res; } [HttpPost] public ResponseData<string> update([FromBody]WelderEntrance welder) { ResponseData<string> res = new ResponseData<string>(); try { res.successful = true; BLL.APIWelderEntranceService.UpdateBSWelder(welder); } catch (Exception e) { res.successful = false; } return res; } } }