我有这个代码:
public class TrainingModuleProgressStateDataModelResults
{
public IEnumerable<DataModels.Training.TrainingModuleProgressStateDataModel> TrainingModuleProgressStates { get; set; }
}
public class TrainingModuleProgressStateDataModel
{
public IEnumerable<UserTrainingPointsDataModel> UserTrainingPoints { get; set; }
}
我需要将其拆分为:
public class UserTrainingPointsDataModel
{
public virtual int InteractionType { get; set; }
public virtual int Points { get; set; }
public virtual string Name { get; set; }
}
在我的存储库中,我从数据库中返回RawPoints
:
China Incentive Program,50,6,1|India - Q2 Incentive ,50,6,4|China - Q2 Incentive,50,6,5|India Incentive Program,100,8,3|India - Q2 Incentive ,100,8,4
每个集合都由 分隔,pipe character
然后50 = the points,6
是交互类型,1
是 trainingmoduleid(我不再需要将其拉出)并且名称很好,名称 :)
string RawPoints = row["RawPoints"].ToString();
foreach (var RawPoint in RawPoints)
{
UserTrainingPointsDataModel.Name = RawPoints.Name;???
}