Пример #1
0
        public static void Patch(this CardModel cardModel, Card card,
                                 SerieModel serieModel, FactionModel factionModel, CardTypeModel cardTypeModel, StatusModel statusModel, RuleSetModel ruleSetModel, LicenseModel artworkLicense, UserModel user)
        {
            if (cardModel == null)
            {
                return;
            }
            if (card == null)
            {
                return;
            }
            cardModel.Name            = card.Name;
            cardModel.FirstName       = card.FirstName;
            cardModel.LastName        = card.LastName;
            cardModel.Artist          = card.Artist;
            cardModel.ArtworkLicensor = card.ArtworkLicensor;
            cardModel.RuleText        = card.RuleText;
            cardModel.FlavorText      = card.FlavorText;
            cardModel.SubType         = card.SubType;
            cardModel.Cost            = card.Cost;
            cardModel.Loyalty         = card.Loyalty;
            cardModel.Attack          = card.Attack;
            cardModel.Defense         = card.Defense;
            cardModel.Info            = card.Info;
            cardModel.MarkdownText    = card.MarkdownText;
            cardModel.LanguageCode    = card.Language?.LanguageCode ?? "en";


            if (serieModel != null)
            {
                cardModel.Serie = serieModel;
            }
            if (factionModel != null)
            {
                cardModel.Faction = factionModel;
            }
            if (cardTypeModel != null)
            {
                cardModel.Type = cardTypeModel;
            }
            if (statusModel != null)
            {
                cardModel.Status = statusModel;
            }
            if (ruleSetModel != null)
            {
                cardModel.RuleSet = ruleSetModel;
            }
            if (artworkLicense != null)
            {
                cardModel.ArtworkLicense = artworkLicense;
            }

            cardModel.PatchBase(user);
        }