示例#1
0
        internal void DeletePhoto(Character character, PhotoSlot slot)
        {
            if (character.AvatarSlot == slot.Identifier)
            {
                character.AvatarSlot = null;
                this.db.Write((c) => c.CharacterUpdate(character));
            }

            this.db.Write((c) => c.PhotoSlotDelete(slot));
        }
示例#2
0
        internal void SetPhoto(string token, uint id, string slot, string hash)
        {
            Log.Debug("Client {token} of {id} setting photo {slot} to {hash}", token, id, slot, hash);
            var character = this.characterService.FindAndAuthorize(token, id);

            try
            {
                var photoSlot = this.db.Read((c) => c.PhotoSlotGet(character, slot));
                photoSlot.Hash = hash;

                this.db.Write((c) => c.PhotoSlotUpdate(photoSlot));
            }
            catch (Database.NotFoundException)
            {
                var photoSlot = new PhotoSlot
                {
                    CharacterId = character.Id,
                    Identifier  = slot,
                    Hash        = hash,
                };

                this.db.Write((c) => c.PhotoSlotInsert(photoSlot));
            }
        }
示例#3
0
 internal void PhotoSlotDelete(PhotoSlot slot)
 {
     this.connection.Delete(slot);
 }
示例#4
0
 internal void PhotoSlotUpdate(PhotoSlot slot)
 {
     this.connection.Update(slot);
 }
示例#5
0
 internal void PhotoSlotInsert(PhotoSlot slot)
 {
     this.connection.Insert(slot);
 }