public async Task <ApiResult> Update([FromBody] UpdateBuildingInput input, CancellationToken cancellationToken) { if (Authorization == null) { return(new ApiResult(APIResultCode.Unknown, APIResultMessage.TokenNull)); } var user = _tokenManager.GetUser(Authorization); if (user == null) { return(new ApiResult(APIResultCode.Unknown, APIResultMessage.TokenError)); } if (string.IsNullOrWhiteSpace(input.Name)) { throw new NotImplementedException("楼宇名称信息为空!"); } await _buildingService.UpdateAsync(new BuildingDto { Id = input.Id, Name = input.Name, OperationTime = DateTimeOffset.Now, OperationUserId = user.Id.ToString() }); return(new ApiResult()); }
public async Task UpdateBuilding(UpdateBuildingInput input) { var entity = await _manager.BuildingRepository.GetAsync(input.Id); entity.CommunityId = input.CommunityId; entity.BuildingName = input.BuildingName; await _manager.UpdateAsync(entity); }