0
我的控制器有2個動作:多個動作4
[HttpPost]
public ActionResult Upload(HttpPostedFileBase[] files)
{
foreach (HttpPostedFileBase file in files)
{
string path = System.IO.Path.Combine(Server.MapPath("~/App_Data"), System.IO.Path.GetFileName(file.FileName));
file.SaveAs(path);
}
ViewBag.Message = "File(s) uploaded successfully";
return RedirectToAction("Index");
}
//
// GET: /AdultLiteracyTeachers/Details/5
public ActionResult Details(int id = 0)
{
AdulLiteracyTeachers adulliteracyteachers = db.AdulLiteracyTeachers.Find(id);
if (adulliteracyteachers == null)
{
return HttpNotFound();
}
return View(adulliteracyteachers);
}
我在Create.cshtml視圖
問題是 只能上傳工作,當我提交按鈕其他創建等不工作 如何調用單個窗體中的多個操作創建按鈕?
您要發佈到詳細信息操作的標識 – Ni3
我的詳細信息正在運行,但上傳不起作用。當我把行動和控制器名稱詳細sto.pped工作 –
你是否意味着這個'RedirectToAction(「索引」)''RedirectToAction(「詳細信息」)'? – AaronLS