I have the following route config in my mvc4 project:
routes.MapRoute(
name: "single",
url: "{controller}/{id}",
defaults: new { controller = "Home", action = "Details" },
constraints: new { id = @"^[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}$" }
);
routes.MapRoute(
name: "singleCreate",
url: "{controller}/{id}/{action}",
defaults: new { controller = "GalleryImage", action = "Create" },
constraints: new { id = @"^[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}$" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
and now i would like to create a link to the route "singleCreate".
I've tried this:
@Html.ActionLink("Add Image", "Create", "GalleryImage", new { id = Model.Id }, null)
but this doesn't work as I expected. I get a Link without an action which looks like this:
/GalleryImage/cc66338c-6500-4967-8be9-a8a6948f22c4
The link should be like this:
/GalleryImage/cc66338c-6500-4967-8be9-a8a6948f22c4/Create
Has anyone already created such a link and can give me some suggestions? Thanks in advance.