Ejemplo n.º 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);
            }
        });
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
 /****************************************************************************/
 public async Task Remove(Guid id)
 {
     await _blobStore.Delete(id.ToId());
 }