表单提交时我没有收到输出。这是我目前的努力。我是php的新手,尝试了各种技术,但似乎没有任何工作。该文件只刷新一个空页。
public ActionResult Create()
{
var catlist = db.Categories.Select(x => new { id = x.id, name = x.name }).ToList();
SelectList sl = new SelectList(catlist.AsEnumerable(), "id", "name");
ViewBag.SelectCategories = sl;
var countrylist = db.CountryTb.Select(x => new { id = x.id, name = x.name }).ToList();
SelectList s2 = new SelectList(countrylist.AsEnumerable(), "id", "name");
ViewBag.SelectCountry = s2;
return View();
}
[HttpPost]
public ActionResult Create(Item i)
{
db.Items.Add(i);
db.SaveChanges();
return RedirectToAction("Index");
}