public static Character ConvertToDbModel(CensusCharacterModel censusModel) { bool isOnline; if (int.TryParse(censusModel.OnlineStatus, out int onlineStatus)) { isOnline = onlineStatus > 0 ? true : false; } else // "service_unavailable" { isOnline = false; } return(new Character { Id = censusModel.CharacterId, Name = censusModel.Name.First, FactionId = censusModel.FactionId, TitleId = censusModel.TitleId, WorldId = censusModel.WorldId, BattleRank = censusModel.BattleRank.Value, BattleRankPercentToNext = censusModel.BattleRank.PercentToNext, CertsEarned = censusModel.Certs.EarnedPoints, PrestigeLevel = censusModel.PrestigeLevel, IsOnline = isOnline }); }
public static Character ConvertToDbModel(CensusCharacterModel censusModel) { return(new Character { Id = censusModel.CharacterId, Name = censusModel.Name.First, FactionId = censusModel.FactionId, TitleId = censusModel.TitleId, WorldId = censusModel.WorldId, BattleRank = censusModel.BattleRank.Value, BattleRankPercentToNext = censusModel.BattleRank.PercentToNext, CertsEarned = censusModel.Certs.EarnedPoints, PrestigeLevel = censusModel.PrestigeLevel }); }