/// <summary> /// 创建联系方式 /// </summary> /// <param name="entity">实体对象</param> /// <returns></returns> public Common.ClientResult.Result Post([FromBody] EmployeeContact entity) { IBLL.IEmployeeContactBLL c_BLL = new EmployeeContactBLL(); Common.ClientResult.Result result = new Common.ClientResult.Result(); if (entity != null && ModelState.IsValid) { entity.State = "启用"; entity.CreateTime = DateTime.Now; entity.CreatePerson = LoginInfo.RealName; //entity.EmployeeId = LoginInfo.UserID; string returnValue = string.Empty; if (c_BLL.Create(ref validationErrors, entity)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",员工银行的信息的Id为" + entity.Id, "员工银行" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.InsertSucceed; return(result); //提示创建成功 } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",员工银行的信息," + returnValue, "员工银行" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.InsertFail + returnValue; return(result); //提示插入失败 } } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 return(result); }
/// <summary> /// 联系方式列表 /// </summary> /// <param name="getParam"></param> /// <returns></returns> public Common.ClientResult.DataResult PostData([FromBody] GetDataParam getParam) { IBLL.IEmployeeContactBLL c_BLL = new EmployeeContactBLL(); int total = 0; List <EmployeeContact> queryData = c_BLL.GetByParam((int)getParam.id, getParam.page, getParam.rows, getParam.order, getParam.sort, getParam.search, ref total); var data = new Common.ClientResult.DataResult { total = total, rows = queryData.Select(s => new { Id = s.Id, Telephone = s.Telephone, MobilePhone = s.MobilePhone, State = s.State }) }; return(data); }
public EmployeeContactApiController(EmployeeContactBLL bll) { m_BLL = bll; }