public CardTypeModel CreateCardType(string name, Guid guid, TemplateInfoModel templateInfo) { var cardType = Context.CardTypes.FindByGuid(guid); if (cardType == null) { var utcNow = DateTime.UtcNow; cardType = new CardTypeModel { Name = name, Guid = guid, LastModifiedTime = utcNow, CreateTime = utcNow, Creator = ServiceUser, LastModifiedBy = ServiceUser, TemplateInfo = templateInfo }; Context.CardTypes.Add(cardType); Context.SaveChanges(); } return(cardType); }
public static TemplateInfo FromDal(this TemplateInfoModel templateInfoModel) { if (templateInfoModel == null) { return(null); } var result = new TemplateInfo { Id = templateInfoModel.TemplateInfoId, ShowName = templateInfoModel.ShowName, ShowType = templateInfoModel.ShowType, ShowGoldCost = templateInfoModel.ShowGoldCost, ShowLoyalty = templateInfoModel.ShowLoyalty, ShowText = templateInfoModel.ShowText, ShowAttack = templateInfoModel.ShowAttack, ShowDefense = templateInfoModel.ShowDefense, ShowDiscipline = templateInfoModel.ShowDiscipline, ShowArt = templateInfoModel.ShowArt, ShowInfo = templateInfoModel.ShowInfo, MaxTextBoxWidth = templateInfoModel.MaxTextBoxWidth, MaxTextBoxHeight = templateInfoModel.MaxTextBoxHeight, }; return(result.SyncBase(templateInfoModel)); }
public TemplateInfoModel CreateTemplateInfoModel() { var utcNow = DateTime.UtcNow; var templateInfo = new TemplateInfoModel { LastModifiedTime = utcNow, CreateTime = utcNow, Creator = ServiceUser, LastModifiedBy = ServiceUser, Guid = Guid.NewGuid(), }; return(templateInfo); }
public static void Patch(this CardTypeModel cardTypeModel, CardType cardType, TemplateInfoModel templateInfoModel, UserModel user) { if (cardTypeModel == null) { return; } cardTypeModel.Name = cardType.Name; cardTypeModel.TemplateInfo = templateInfoModel; cardTypeModel.PatchBase(user); }