Pro ASP.NET MVC 3 Framework (Expert's Voice in .NET)

Pro ASP.NET MVC 3 Framework (Expert's Voice in .NET)

Adam Freeman

Language: English

Pages: 852

ISBN: 1430234040

Format: PDF / Kindle (mobi) / ePub

The ASP.NET MVC 3 Framework is the latest evolution of Microsoft’s ASP.NET web platform. It provides a high-productivity programming model that promotes cleaner code architecture, test-driven development, and powerful extensibility, combined with all the benefits of ASP.NET 4.

In this third edition, the core model-view-controller (MVC) architectural concepts are not simply explained or discussed in isolation, but are demonstrated in action. You’ll work through an extended tutorial to create a working e-commerce web application that combines ASP.NET MVC with the latest C# language features and unit-testing best practices. By gaining this invaluable, practical experience, you’ll discover MVC’s strengths and weaknesses for yourself―and put your best-learned theory into practice.

The book's authors Steve Sanderson and Adam Freeman have both watched the growth of ASP.NET MVC since its first release. Steve is a well-known blogger on the MVC Framework and a member of the Microsoft Web Platform and Tools team. Adam started designing and building web applications 15 years ago and has been responsible for some of the world's largest and most ambitious projects. You can be sure you are in safe hands.

Web Mapping Illustrated: Using Open Source GIS Toolkits

PHP jQuery Cookbook

Real-time Web Application Development using Vert.x 2.0

SignalR: Real-time Application Development

A Practical Guide to Managing Web Projects















for the moment; but don’t worry—if you are new to MVC, you’ll find plenty to keep you interested. Where we use something without explaining it, we provide a reference to the chapter where you can find all the details. Creating a New ASP.NET MVC Project We are going to start by creating a new MVC project in Visual Studio. Select New Project from the File menu to open the New Project dialog. If you select the Web templates, you’ll see that the MVC 3 installer has created a new item called ASP.NET

(if it prompts you to enable debugging, just click the OK button). You can see the result in Figure 3-3. Since we started with the empty project template, the application doesn’t contain anything to run, so we see a 404 Not Found Error. Figure 3-3. Trying to run an empty project When you’re finished, be sure to stop debugging by closing the browser window that shows the error, or by going back to Visual Studio and selecting Stop Debugging from the Debug menu. Adding the First Controller In MVC

regular-style getters and setters. Using Object and Collection Initializers Another tiresome programming task is constructing a new object and then assigning values to the properties, as shown in Listing 5-6. Listing 5-6. Constructing and Initializing an Object with Properties using System; class Program { static void Main(string[] args) { // create a new Product object Product myProduct = new Product(); // set the property values myProduct.ProductID = 100; myProduct.Name = "Kayak";

"Soccer ball", Category = "Soccer", Price = 19.50M}, "Corner flag", Category = "Soccer", Price = 34.95M} CHAPTER 5 ■ ESSENTIAL LANGUAGE FEATURES var results = products .OrderByDescending(e => e.Price) .Take(3) .Select(e => new { e.Name, e.Price }); foreach (var p in results) { Console.WriteLine("Item: {0}, Cost: {1}", p.Name, p.Price); } Console.WriteLine("---End of results---"); products[2] = new Product { Name = "Stadium", Price = 79500M }; foreach (var p in results) {

SportsStore.WebUI.Models.ProductsListViewModel @{ ViewBag.Title = "Products"; } @foreach (var p in Model.Products) {





@Html.PageLinks(Model.PagingInfo, x => Url.Action("List", new {page = x}))

185 CHAPTER 7 ■ SPORTSSTORE: A REAL APPLICATION If you run the application, you’ll see that we’ve added page links, as illustrated in Figure 7-17. The style is still pretty basic, and

Download sample