I am working on an ASP.Net MVC 4 application and trying to display a single row of data from the data base instead of all rows.
The website I am designing has a list of buttons and when each button is clicked the data from the corresponding row in the database is displayed e.g. Button1 - Row1, Button2 - Row2 etc...
Currently this is also displayed on http://myexample/Movies/OneMovie I would like it to be displayed on http://myexample/Movies/
The code I have in my controller is this:
public ActionResult OneMovie(int id = 0)
{
Movie movie = db.Movies.Single(m => m.ID == id);
if (movie == null)
{
return HttpNotFound();
}
return View(movie);
}
The button for my code is:
<input id="Button1" type="button" value="button" name="id"/>
<input id="Button2" type="button" value="button" name="id"/>
Can anyone help me to display my data for the corresponding row when the button is clicked?