feedbackController中方法重載出現(xiàn)問(wèn)題
feedbackController中方法不能重載,把上面一段注釋了才能成功。否則出現(xiàn)下圖,該怎么搞啊老師
/*? ? ?public IActionResult Index()
? ? ? ? {
? ? ? ? ? ? return View();
? ? ? ? }
*/
? ? ? ? public IActionResult Index(feedback feedback)
? ? ? ? {
? ? ? ? ? ? if (ModelState.IsValid)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? _feedback.Addfeedback(feedback);
? ? ? ? ? ? ? ? return RedirectToAction("feedbackComplete");
? ? ? ? ? ? }
? ? ? ? ? ? return View();
? ? ? ? }
2021-08-26
[HttpPost]? //在FeedbackController.cs文件中加[HttpPost]即可
? ? ? ? public IActionResult Index(Feedback feedback)
? ? ? ? {
? ? ? ? ? ? //錯(cuò)誤提示與ModelState通過(guò)ASP.NET MVC的內(nèi)置功能 Tag Helper連接
? ? ? ? ? ? if (ModelState.IsValid)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? _feedbackRepository.AddFeedback(feedback);
? ? ? ? ? ? ? ? return RedirectToAction("Feedbackcomplete");
? ? ? ? ? ? }
? ? ? ? ? ? return View();
? ? ? ? }
2020-12-16
你沒(méi)加屬性
2020-02-12
失敗是因?yàn)槁酚傻脑?/p>