I have this code which returns a view:
public ActionResult Survey(int idProject, string name)
{
return View(Surveys.Data.Services.Project.GetAllSurveys(idProject));
}
When I call this from client with
@Url.Action("Survey", "Project", new { idProject = project.IdProjet, name = project.Nom })
The url appear with parameters ?idProject=2&name=work which I have been told is not the correct way to work in MVC.
I don't think an ajax call would be of good use here since I return a view to the client.
So how should I call this ActionResult Survey?
Add the following to you RouteConfig.cs
file before the default route
routes.MapRoute(
name: "ProjectSurvey",
url: "Project/Survey/{idProject}/{name}",
defaults: new { controller = "Project", action = "Survey" }
);