public override async Task <WopiResponse> PutUserInfo(PutUserInfoRequest putUserInfoRequest) { var userId = WopiSecurity.GetIdentityNameFromToken(putUserInfoRequest.AccessToken); var wopiFileRespository = new WopiFileRepository(); var response = await wopiFileRespository.SaveWopiUserInfo(putUserInfoRequest.ResourceId, userId, putUserInfoRequest.UserInfo); if (response == HttpStatusCode.NotFound) { return(putUserInfoRequest.ResponseNotFound()); } else if (response == HttpStatusCode.OK) { return(putUserInfoRequest.ResponseOK()); } else { return(putUserInfoRequest.ResponseServerError(string.Format("Unknown HTTPStatusCode from WopiFileRepository.SaveWopiUserInfo: {0}", response))); } }
public override async Task <WopiResponse> PutUserInfo(PutUserInfoRequest putUserInfoRequest) { WopiResponse wopiResponse = null; var file = DocumentDBRepository <DetailedFileModel> .GetItem("Files", i => i.id.ToString() == putUserInfoRequest.ResourceId); // Check for null file if (file != null) { file.UserInfo = putUserInfoRequest.UserInfo; // Update the file in DocumentDB await DocumentDBRepository <FileModel> .UpdateItemAsync("Files", file.id.ToString(), (FileModel)file); // Return success return(putUserInfoRequest.ResponseOK()); } else { wopiResponse = putUserInfoRequest.ResponseNotFound(); } return(wopiResponse); }