The goal
Add property and value to List. I'm using C#/MVC 4/Razor.
The problem
I have the following:
return PartialView("_CategoriesList", db.bm_product_categories.ToList());
Ok, all good here. My list returns me multiple columns from database and one of them is Category_Name
. I want to "slugify" each category name with C# and then pass to view. I was thinking in something like this:
foreach (var categorySlug in db.bm_product_categories)
{
db.bm_product_categories
.Add({
"Category_Name_Slugged":
Helpers.Slugify(db.bm_product_categories.Category_Name)
});
}
But, obviously, this syntax is wrong — I do not know what to do.
Ideas?