Esempio n. 1
0
        public async Task <BaseResult> ChangeLockStatusAsync(ChangeStatusModel model)
        {
            var result = new BaseResult();
            //判断状态是否发生变化,没有则修改,有则返回状态已变化无法更改状态的提示
            var isLock = await _repository.GetLockStatusByIdAsync(model.Id);

            if (isLock == !model.Status)
            {
                var count = await _repository.ChangeLockStatusByIdAsync(model.Id, model.Status);

                if (count > 0)
                {
                    result.ResultCode = ResultCodeAddMsgKeys.CommonObjectSuccessCode;
                    result.ResultMsg  = ResultCodeAddMsgKeys.CommonObjectSuccessMsg;
                }
                else
                {
                    result.ResultCode = ResultCodeAddMsgKeys.CommonExceptionCode;
                    result.ResultMsg  = ResultCodeAddMsgKeys.CommonExceptionMsg;
                }
            }
            else
            {
                result.ResultCode = ResultCodeAddMsgKeys.CommonDataStatusChangeCode;
                result.ResultMsg  = ResultCodeAddMsgKeys.CommonDataStatusChangeMsg;
            }
            return(result);
        }