例如,我希望能够发送my.url / movie?title =“a”&rating =“b”并在电影表中使用适当的数据创建一个新行。
这可能吗?
我尝试过的一种方法是创建movie.aspx,它也有movie.aspx.cs和movie.cs,可以解析信息。 我可以发送带有相关信息的帖子请求吗?
我是asp.net,mvc和c#的新手。
For instance, I'd like to be able to send my.url/movie?title="a"&rating="b" and create a new row in the movie table with the appropriate data.
Is this possible?
One method I've attempted is creating movie.aspx which has movie.aspx.cs and movie.cs as well which can parse the information. Could I then send a post request with the relevant information, maybe?
I'm incredibly new to asp.net, mvc, and c#.
最满意答案
当然,在使用示例URL触发的控制器中,为Movie构建一个如下所示的处理程序:
public ActionResult Movie(string title, string rating) { // do your work here return View("SomeViewHere"); }其中SomeViewHere是您想要在完成时重定向到的视图。
Certainly, in the controller that is fired with the example URL, build a handler for Movie that looks like this:
public ActionResult Movie(string title, string rating) { // do your work here return View("SomeViewHere"); }where SomeViewHere is the view you want to redirect to when you're done.
更多推荐
movie,new,send,电脑培训,计算机培训,IT培训"/> <meta name="description&qu
发布评论