i have a Post Controller that should handle routes like these:
mywebsite.com/post/somthing
mywebsite.com/post/post1
mywebsite.com/post/anotherpost
...
when i searched online for my answer i found how to register my map route like this:
routes.MapRoute(
name: "post",
template: "post/{*postname}",
defaults: new { controller = "Post", action = "ReadPost" });
but i don't know that when i create a controller and action method for my route how to take the {*article} as an input for my method so that method know what model to return with view.
also my controller should have to handle following routes as well:
mywebsite.com/post/anotherpost/comments
mywebsite.com/post/anotherpost/edit
mywebsite.com/post/anotherpost/author
when the route ends with nothing it should be redirected to ReadPost(string postName)
when the route ends with comments it should be redirected to ReadComment(string postName)
when the route ends with edit it should be redirected to Edit(string postName)
and when the route ends with author it should be redirected to ReadAuthor(string postName)
how should i write the controller and routemapping so that proper route connect to proper action and give the method the "post name" as input?
article?