/// <summary> /// Возвращает настройки внешнего вида игрока /// </summary> public PlayerAppearance Get(long accountId) { using (var db = new Database()) { var entity = db.PlayersAppearance.FirstOrDefault(e => e.AccountId == accountId); return(PlayerAppearanceConverter.ConvertToModel(entity)); } }
/// <summary> /// Сохраняет настройки внешнего вида игрока /// </summary> public void Save(long accountId, PlayerAppearance model) { var entity = PlayerAppearanceConverter.ConverToEntity(accountId, model); using (var db = new Database()) { if (db.PlayersAppearance.FirstOrDefault(e => e.AccountId == accountId) == null) { db.Insert(entity); } else { db.Update(entity); } } }