コード例 #1
0
ファイル: PhotoService.cs プロジェクト: slavig/pepperspray
        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
ファイル: PhotoService.cs プロジェクト: slavig/pepperspray
        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);
 }