标签:post 转换 tca where foreach entity lca reac each
var categoriesEntities = new List<CategoryEntity>();
var allCategories = GetCategories();
var postCategoryMappings = _postCategoryMapping.Where(m => m.PostID == postID).ToList();
postCategoryMappings.ForEach(mapping =>
{
var category = allCategories.Single(c => c.CategoryID == mapping.CategoryID);
var categoryEntity = new CategoryEntity { CategoryID = mapping.CategoryID, CategoryName = category.CategoryName, CategorySlug = category.CategorySlug };
categoriesEntities.Add(categoryEntity);
});
标签:post 转换 tca where foreach entity lca reac each
原文地址:http://www.cnblogs.com/opts/p/7753811.html