public ActionResult ShopInfo()
{
ViewBag.ShopList = ShopService.GetEntities(x => x.IsDelete ==
false).OrderByDescending(x =>
x.Sort).ToList();
var ShopList = ShopService.GetEntities(x => x.IsDelete ==
false).GroupBy(x =>
new
{
x.CityName
}).Select(x =>
new
{
Name =
x.Key.CityName,
}).ToList();
string str =
string.Empty;
foreach (
var item
in ShopList)
{
str +=
",'" + item.Name +
"'";
}
ViewBag.Str = str.Substring(
1);
// 店名1,店名2,店名3
return View();
}
转载于:https://www.cnblogs.com/SeNaiTes/p/8877097.html