@ Html.ActionLink(“编辑”,“EditAbout”,“EditAboutPage”)给我找不到404文件

时间:2016-05-10 13:36:20

标签: c# asp.net-mvc-5

我试图制作一个编辑功能,但是我的@Html.ActionLink("Edit", "EditAbout", "EditAboutPage")不能正常工作我不会发送给我,我只找到404文件。

这是我的控制器

public class EditAboutPageController : Controller
{
    // GET: EditAboutPage
    public ActionResult EditAbout()
    {
        var currentAboutInfo = Repository.GetLatestAbouts();
        return View(currentAboutInfo);
    }
    [HttpPost]
    public ActionResult EditAbout(EditAboutModel model)
    {
        if (ModelState.IsValid)
        {
            var about = Repository.GetLatestAbouts();
            Repository.UpdateAbouts(Repository.SetAboutValues(model, about));
            return RedirectToAction("Index", "About");
        }

        return View(model);
    }
 }

我做错了什么?

2 个答案:

答案 0 :(得分:0)

方法使用[HttpGet]

[HttpGet]
public ActionResult EditAbout()
{
    var currentAboutInfo = Repository.GetLatestAbouts();
    return View(currentAboutInfo);
}

答案 1 :(得分:0)

尝试使用此重载选项以避免路由模糊

  @Html.ActionLink("Edit","EditAbout","EditAboutPage",null,null)