So this is the method in my repository I use to get records from my db via its Id
public BlogsTable GetBlogPosts(int id)
{
return db.BlogsTables.SingleOrDefault(d => d.Id == id);
}
And this is my controller using the get method
public ActionResult Details(int id)
{
BlogsTable blogPostDetails = repo.GetBlogPosts(id);
return View(blogPostDetails);
}
What I need is to be able to write a get method that allows me to get records from my db by the title, instead of its id. This is what I have now
Also, how to I set the route to use that method? This is what I have now
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Blog", action = "Index", id = "" }
);