Book Image

SignalR Blueprints

By : Einar Ingerbrigsten
Book Image

SignalR Blueprints

By: Einar Ingerbrigsten

Overview of this book

Table of Contents (18 chapters)
SignalR Blueprints
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
9
Debugging or Troubleshooting
Index

Master/detail – navigation


Speaking of which, we haven't put in something that enables us to actually see the article with the full body, and so on. Let's just quickly do this.

Add a new Controller class called ArticleController. As we only need one action in it, enter the following code:

using System.Web.Mvc;
using Chapter3.DAL;

namespace Chapter3.Controllers
{
    public class ArticleController : Controller
    {
        // GET: Article
        public ActionResult Full(int id)
        {
            using( var articleContext = new ArticleContext() )
            {
               var article = articleContext.GetArticle(id);
               return View(article);
            }
        }
    }
}

The action takes the identifier as an argument and uses it when calling GetArticle() on ArticleContext. This gets the specific article that we will use as a ViewModel for the page.

Note

Routing is a concept in ASP.NET MVC that describes allowed URLs and what to do with them. If you navigate to App_Start\RouteConfig...