我的问题是这个问题的一部分:
我从一个表单中收到了一个id的集合.我需要获取密钥,将它们转换为整数并从数据库中选择匹配的记录.
[HttpPost]
public ActionResult Report(FormCollection collection)
{
var listofIDs = collection.AllKeys.ToList();
// List<string> to List<int>
List<Dinner> dinners = new List<Dinner>();
dinners= repository.GetDinners(listofIDs);
return View(dinners);
}
Run Code Online (Sandbox Code Playgroud) c# ×1