Asp.net mvc 如何在@URL中放置多个Id参数。操作,控制器获取ID

Asp.net mvc 如何在@URL中放置多个Id参数。操作,控制器获取ID,asp.net-mvc,asp.net-mvc-4,Asp.net Mvc,Asp.net Mvc 4,我有这样的看法 <td><a href="@Url.Action("AddingAnnouncement", new { id = item.ScheduleID,name =item.EmployeeID})" class="btn btn-warning"><i class="fas fa-plus"></i> Adding Announcement</a></td> NVm找到了该死的我从没想过这么简单我哈哈XD 在

我有这样的看法

<td><a href="@Url.Action("AddingAnnouncement", new { id = item.ScheduleID,name =item.EmployeeID})" class="btn btn-warning"><i class="fas fa-plus"></i> Adding Announcement</a></td>

NVm找到了该死的我从没想过这么简单我哈哈XD

在get控制器上

[Authorize(Roles = "Faculty")]
public ActionResult AddingAnnouncement(int? name)
{

    return View (name);

}

[HttpPost]
public ActionResult AddingAnnouncement(int? id,int? name, Announcement model, HttpPostedFileBase file)
{
    Announcement annc = new Announcement();
    var ErrorMessage = "";
    var filesize = 25000;
    foreach (var item in model.File)
    {
        try
        {
            var supportedTypes = new[] { "txt", "doc", "docx", "pdf", "xls", "xlsx" };
            var fileExt = System.IO.Path.GetExtension(file.FileName).Substring(1);
            if (!supportedTypes.Contains(fileExt))
            {
                ErrorMessage = "File Extension Is InValid - Only Upload WORD/PDF/EXCEL/TXT File";
                return Content(ErrorMessage);
            }
            else if (file.ContentLength > (filesize * 1024))
            {
                ErrorMessage = "File size Should Be UpTo " + filesize + "KB";
                return Content(ErrorMessage);
            }

            else
            {
                annc.MainAnnouncement = model.MainAnnouncement;
                annc.EmployeeID = name;
                annc.DatePosted = DateTime.Now;
                annc.ScheduleID = id;
                annc.DocumentFile = ConverToByte(item);
                annc.FileType = file.ContentType;
                annc.FileName = file.FileName;
                db.Announcements.Add(annc);
                string path = Path.Combine(Server.MapPath("~/Files/TeachingMaterials/"), Path.GetFileName(file.FileName));
                file.SaveAs(path);
                db.SaveChanges();
            }
        }
        catch (Exception ex)
        {
            ErrorMessage = "Upload Container Should Not Be Empty or Contact Admin";
            return Content(ErrorMessage);
        }



    }
    return RedirectToAction("FacultySchedule");
}
    [Authorize(Roles = "Faculty")]
    public ActionResult AddingAnnouncement(int? name)
    {
        Announcement model = new Announcement();
        model.EmployeeID = name;
        return View(model);

    } 
然后在岗位上

    [HttpPost]
    public ActionResult AddingAnnouncement(int? id,Announcement model,    HttpPostedFileBase file)
    {
    }

如果我不把name参数放在get中,它就不会在post部分中获取name的值。你知道如何获取它吗?