Esempio n. 1
0
        private void ChangeMemberImage()
        {
            Byte[] imageBytes = GetMemberImageAsBytes();
            if (imageBytes == null)
                return;

            MemberAvatar avatar = new MemberAvatar();
            avatar.MemberUId = MemberProfile.MemberUId;
            avatar.AvatarImage = imageBytes;

            executor.StartBackgroundTask(
                () => { teamService.UpdateMemberAvatar(MemberProfile.MemberUId, avatar); },
                () => {
                    myProfileNocache = new Random().Next().ToString();
                    DefineMemberAvatarUrl();
                });
        }
Esempio n. 2
0
 public void UpdateMemberAvatar(string memberUId, MemberAvatar avatar)
 {
     authorizationService.VerifyUser(SafeMemberUId(memberUId));
     teamRepository.SaveMemberAvatar(avatar);
 }
 public void UpdateMemberAvatar(string memberUId, MemberAvatar avatar)
 {
     var client = ClientHelper.GetClient(authorizationService);
     HttpResponseMessage response = client.Put(Url("Members/" + SafeMemberUId(memberUId) + "/Avatar"), new ObjectContent<MemberAvatar>(avatar, JsonValueMediaTypeFormatter.DefaultMediaType));
     ClientHelper.HandleHTTPErrorCode(response);
 }
        public void SaveMemberAvatar(MemberAvatar avatar)
        {
            using (var context = new ScrumFactoryEntities(this.connectionString)) {
                MemberProfile oldMember = GetMember(avatar.MemberUId);

                MemberAvatar oldAvatar = GetMemberAvatar(avatar.MemberUId);

                if (oldMember == null)
                    throw new System.Exception("member not found");

                if (oldAvatar == null) {
                    context.MembersAvatar.AddObject(avatar);
                } else {
                    context.AttachTo("MembersAvatar", oldAvatar);
                    context.ApplyCurrentValues<MemberAvatar>("MembersAvatar", avatar);
                }

                context.SaveChanges();

            }
        }