コード例 #1
0
        public Operation <string> UpdateProfileImage(EncodedBinaryData image, string oldImageUrl)
        => _authorizer.AuthorizeAccess(UserContext.CurrentProcessPermissionProfile(), () =>
        {
            var user = UserContext.CurrentUser();

            var url = _blobStore.Delete(oldImageUrl) //shouldnt fail even if oldImageUrl is null
                      .Then(opr => _blobStore.Persist(image))
                      .Resolve();

            //create the ProfileImage UserData and store the url
            var userData = _query.GetUserData(user, Constants.UserData_ProfileImage) ?? new UserData
            {
                Name    = Constants.UserData_ProfileImage,
                OwnerId = user.UserId,
                Type    = CommonDataType.Url
            };

            //set the data
            userData.Data = url;

            if (userData.EntityId > 0)
            {
                return(_pcommand.Update(userData).Resolve().Data);
            }

            else
            {
                return(_pcommand.Add(userData).Resolve().Data);
            }
        });
コード例 #2
0
        public void Verify_delete_stream()
        {
            const String content      = "this is the content of the file";
            String       tempFileName = GenerateTempTextFile(content, "test1.txt");
            var          id           = _sut.Upload(DocumentFormats.Original, tempFileName);

            Assert.That(id, Is.Not.Null);
            _sut.Delete(id);

            Assert.Throws <Exception>(() => _sut.GetDescriptor(id));
        }
コード例 #3
0
ファイル: KeyStore.cs プロジェクト: jim-lightfoot/MondoCore
 /****************************************************************************/
 public async Task Remove(Guid id)
 {
     await _blobStore.Delete(id.ToId());
 }