コード例 #1
0
        public async Task <JsonResponse> EditOperation([FromBody] EditOperationDto model)
        {
            var operation = await _operationServices.QueryById(model.Id);

            if (operation == null)
            {
                throw new UserOperationException("该功能不存在");
            }
            var editModel = _mapper.Map <SysOperation>(model);

            editModel.Creator    = operation.Creator;
            editModel.CreateTime = operation.CreateTime;
            editModel.ModifyTime = DateTime.Now;
            editModel.Reviser    = UserIdentity.UserId;
            editModel.Sort       = operation.Sort;
            editModel.ParentId   = operation.ParentId;

            var mResult = await _operationServices.Update(editModel);

            if (mResult <= 0)
            {
                throw new UserOperationException("更新失败");
            }
            return(new JsonResponse(true));
        }
コード例 #2
0
        public IActionResult Update(Operation operation)
        {
            var result = _operationService.Update(operation);

            if (result.Success)
            {
                return(Ok(result.Success));
            }

            return(BadRequest(result.Message));
        }