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)); }
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)); } }
internal void PhotoSlotDelete(PhotoSlot slot) { this.connection.Delete(slot); }
internal void PhotoSlotUpdate(PhotoSlot slot) { this.connection.Update(slot); }
internal void PhotoSlotInsert(PhotoSlot slot) { this.connection.Insert(slot); }