Wrox Programmer Forums
|
BOOK: Professional ASP.NET MVC 3
This is the forum to discuss the Wrox book Professional ASP.NET MVC 3 by Jon Galloway, Phil Haack, Brad Wilson, K. Scott Allen; ISBN: 978-1-1180-7658-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET MVC 3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 5th, 2011, 02:44 PM
Registered User
 
Join Date: Oct 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch. 5 pg. 96 What happened?

We went from taking about HTML helpers to all of a sudden we have a fully formatted webpage and the search code for the Home Controller doesn't work, not the mention the fact that we don't have a storeDB, and MVCMusicStoreDB kicks an error. Did I miss something?
 
Old October 5th, 2011, 03:10 PM
Registered User
 
Join Date: Oct 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I managed to consult some people who are well versed in this sort of thing and I have figured it out. storeDB is an instance of the MvcMusicStoreDB database but it has to be declared as such. So, before
Code:
 var albums = storeDB.Albums
insert
Code:
MvcMusicStoreDB storeDB = new MvcMusicStoreDB();
So you have this:
Code:
public ActionResult Search(string q)
{
    MvcMusicStoreDB storeDB = new MvcMusicStoreDB();

    var albums = storeDB.Albums
        .Include("Artist")
        .Where(a -> a.Title.Contains(q) || q == null)
        .Take(10);
    return View(albums);
}
I'm still confused as to where the nicely formatted website came from. Does anyone know?

Last edited by MGriessler; October 5th, 2011 at 03:11 PM.. Reason: bolding appropriate areas
 
Old December 9th, 2011, 09:53 PM
Wrox Author
 
Join Date: Oct 2006
Posts: 36
Thanks: 1
Thanked 5 Times in 5 Posts
Default

Sorry this wasn't clear - we'll try to make this more straightforward in the next version of this book. For MVC Music Store related samples, you can always consult the the base MVC Music Store tutorial at http://mvcmusicstore.codeplex.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Fatal Error Chap 3, Pg 96-96 joshkosmala BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 January 8th, 2007 01:55 PM
CH 3 pg 96 Question mririe BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 8 August 25th, 2004 04:17 AM
CH 5 pg 160 wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 8 November 12th, 2003 11:23 PM
CH3, pg 96 Hidden Form Fields wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 19 October 28th, 2003 03:18 PM
CH 3 pg 76 wadesmart BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 October 26th, 2003 08:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.