public static void PopulateFromUDP(this AniDB_Character character, Raw_AniDB_Character rawChar) { if (character.CharID == 0) // a new object { character.Populate(rawChar); } else { // only update the fields that com from UDP API character.CharKanjiName = rawChar.CharKanjiName; character.CharName = rawChar.CharName; //this.CreatorListRaw = rawChar.CreatorListRaw; } }
public static void PopulateFromHTTP(this AniDB_Character character, Raw_AniDB_Character rawChar) { if (character.CharID == 0) // a new object { character.Populate(rawChar); } else { // only update the fields that come from HTTP API character.CharDescription = rawChar.CharDescription; character.CharName = rawChar.CharName; character.CreatorListRaw = rawChar.CreatorListRaw; character.PicName = rawChar.PicName; } }
public static bool PopulateFromUDP(this AniDB_Character character, Raw_AniDB_Character rawChar) { if (character.CharID == 0) // a new object { return(character.Populate(rawChar)); } else { if (string.IsNullOrEmpty(rawChar?.CharKanjiName) || string.IsNullOrEmpty(rawChar.CharName)) { return(false); } // only update the fields that com from UDP API character.CharKanjiName = rawChar.CharKanjiName; character.CharName = rawChar.CharName; //this.CreatorListRaw = rawChar.CreatorListRaw; } return(true); }
public static bool PopulateFromHTTP(this AniDB_Character character, Raw_AniDB_Character rawChar) { if (character.CharID == 0) // a new object { return(character.Populate(rawChar)); } else { // only update the fields that come from HTTP API if (string.IsNullOrEmpty(rawChar?.CharName)) { return(false); } character.CharDescription = rawChar.CharDescription ?? string.Empty; character.CharName = rawChar.CharName; character.CreatorListRaw = rawChar.CreatorListRaw ?? string.Empty; character.PicName = rawChar.PicName ?? string.Empty; } return(true); }