p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET for Visual Studio 2015 (http://p2p.wrox.com/forumdisplay.php?f=800)
-   -   More Chapter 6 problems (http://p2p.wrox.com/showthread.php?t=99357)

Blump74 January 31st, 2017 04:07 PM

More Chapter 6 problems
I downloaded the chapter 6 solution and started working through. When trying to run the Create page i get

Compiler Error Message: CS1503: Argument 1: cannot convert from 'string' to 'RentMyWrox.Models.Hobby'
Line 79: @foreach (string hobby in hobbyList)
Line 80: {
Line 81: string checkedText = Model.Hobbies.Contains(hobby) ? "checked" : string.Empty;
Line 82: <span>
Line 83: <input name="hobbies" value="@hobby" type="checkbox" @checkedText/>

I then tried starting from the downloaded chapter 5 solution only to find the controller folder missing !!!!! - helpful

Does anyone have a solution that works for chapter 6?
I'm losing the will to live with this book and dont see how you can learn from it when you just expecting more and more errors!
Are refunds available[:(!][:(!][:(!][:(!]

nigelh February 19th, 2017 08:41 AM

Experiencing same issue for Chapter 6
I also had the exact same error for this chapter and unfortunately, can't seem to to rectify it e.g. simply commenting out the offending code causes problems with the build elsewhere.

The MVC code itself is complex in any case and I wouldn't expect to get the exact same successful build outcome every time. The shame here is that this chapter is the first one to move away from the web forms approach that sets the book in motion and concentrate on the MVC pattern - hence an immediate problem is rather unfortunate, i'd obviously acquired the book to learn about the technique so am definitely not an expert.

It is a large undertaking to write a book like this which is otherwise very well put together. Hopefully a resolution will surface soon.

george77 September 10th, 2017 02:42 PM

This book should be taken off the market!!
Big problems with Ch5 and now I see others having endless problems with Ch6!
This is appalling!
This book should never have got to the stage of publication!
If the publishers had any sense of moral responsibility they would provide refunds! [:(!][:(!][:(!]

mrajagopalan October 9th, 2017 09:30 PM

Fixed code issue in Chapter 6
I was able to solve the code issue in Chapter 6 (page 193) by checking for null for Model. This works for /Edit and /Create controllers.

string checkedText = string.Empty;
if (Model != null)
checkedText = Model.Hobbies.Contains(hobby)
? "checked"
: string.Empty;



All times are GMT -4. The time now is 11:14 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.