/// <summary>
 /// 修改
 /// </summary>
 /// <param name="iDeptID"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public MessageEntity Put(int iDeptID, [FromBody] P_Department value)
 {
     if (value == null)
     {
         return(MessageEntityTool.GetMessage(ErrorType.FieldError));
     }
     value.iDeptID = iDeptID;
     return(_departmentDAL.Update(value));
 }
Пример #2
0
 /// <summary>
 /// 修改部门信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public Department Update(Department model)
 {
     try
     {
         return(dal.Update(model));
     }
     catch
     {
         throw new Exception("出现程序错误,请联系管理员!");
     }
 }
        public ProcessResult Update(Department newInfoDepartment)
        {
            ProcessResult result = VerifeyModel(newInfoDepartment);

            if (result.Result != Extensions.BLLResult.Verified)
            {
                return(result);
            }

            DAL.Extensions.DataBaseResult insert = _departmentDal.Update(newInfoDepartment);

            switch (insert)
            {
            case DAL.Extensions.DataBaseResult.AlreadyFound:
                result.Result = Extensions.BLLResult.AlreadyFound;
                result.Errors.Add(Extensions.AlreadyFoundString(newInfoDepartment.Name));
                break;

            case DAL.Extensions.DataBaseResult.Error:
                result.Result = Extensions.BLLResult.InnerException;
                result.Errors.Add(Extensions.InnerException);
                break;

            case DAL.Extensions.DataBaseResult.Success:
                result.Result = Extensions.BLLResult.Success;
                result.Errors.Add(Extensions.SuccessProcess);
                break;

            case DAL.Extensions.DataBaseResult.ServerDisable:
                result.Result = Extensions.BLLResult.ServerDisable;
                result.Errors.Add(Extensions.ServerDisable);
                break;

            case DAL.Extensions.DataBaseResult.Referanced:
                break;

            case DAL.Extensions.DataBaseResult.NotFound:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
Пример #4
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="model">实体</param>
 public void Update(Department model)
 {
     dal.Update <Department>(model);
 }