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

You are currently viewing the BOOK: Professional ASP.NET MVC 5 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 January 19th, 2015, 11:06 PM
Authorized User
 
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
Default Ch 12 Sample Code

How does it happen that the model shows "Title" and "Id" but the code sample shows several cases of lower case for the first letter?

This is the sample code:

Code:
<div ng-controller="ListController" class="row">
    <div class="span6">       
        <table class="table table-striped">
            <tr ng-repeat="movie in movies">
                <td>
                    {{movie.title}} id = {{movie.id}}
                </td>
                <td>
                    <button class="btn" ng-click="delete(movie)">Delete</button>
                    <a href="#/details/{{movie.id}}" class="btn">Details</a> 
                </td>
            </tr>    
        </table>        
        <button class="btn" ng-click="create()">Create</button>
    </div>
    <div class="span6">
        <div >
            <div ng-include="'/Client/views/edit.html'"></div>
        </div>
    </div>
</div>
(I added the "id = {{movie.id}}" for a test)

If I try to use lower case for the first letter of the data fields, my code fails?

This is my code:

Code:
<div ng-controller="ListController" class="row">
    <div class="span6">
        <table class="table table-striped">
            <tr ng-repeat="movie in movies">
                <td>
                    {{movie.Title}} id= {{movie.Id}}
                </td>
                <td>
                   
                    <button class="btn" ng-click="delete(movie)">Delete</button>
                    <a href="#/details/{{movie.Id}}" class="btn">Details</a>

                </td>
            </tr>
        </table>
        <button class="btn" ng-click="create()">Create</button>
    </div>
    <div class="span6">
        <div>
            <div ng-include="'/Client/views/edit.html'"></div>
        </div>
    </div>
</div>
BTW, running the sample code requires putting connection strings in the config file.
 
Old January 25th, 2015, 03:06 AM
Wrox Author
 
Join Date: Oct 2006
Posts: 36
Thanks: 1
Thanked 5 Times in 5 Posts
Default

Which code sample are you referring to that shows lower case? Looking through Chapter 12, I only see upper case for Title and Id.
 
Old January 25th, 2015, 10:49 AM
Authorized User
 
Join Date: Dec 2011
Posts: 86
Thanks: 20
Thanked 3 Times in 3 Posts
Default Sample Code

Hi Jon,

It was the sample code that I downloaded. As I'm new to MVC, I try to follow your book to create my own code but also keep referring to the downloaded code to see if I'm getting it right.

As you might guess, I often get things wrong and will resort to cut and paste from the downloaded code. This is how I ran into this problem.

I'm referring to the files in the "Client" folder. The one I mentioned was the "List.html".
 
Old January 28th, 2015, 04:22 PM
Wrox Author
 
Join Date: Oct 2006
Posts: 36
Thanks: 1
Thanked 5 Times in 5 Posts
Default

The sample code (in the download) turns on a camel casing switch in ASP.NET Web API, so the returned JSON properties are camel cased (first character lower cased). You can see how that's done in \App_Start\WebApiConfig.cs.

More info here: http://www.asp.net/web-api/overview/...on_camelcasing





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 12 - sample database error? RedBirdOBX BOOK: Beginning ASP.NET 4 : in C# and VB 1 November 3rd, 2014 02:54 PM
Ch. 12 Connecting to the SQL Server Sample Database KingJames978 BOOK: Beginning ASP.NET 4 : in C# and VB 7 April 6th, 2012 02:39 AM
Ch.9 Sample 2 - How to load? SAinCA BOOK: Beginning Microsoft Visual Studio LightSwitch Development 0 November 14th, 2011 08:27 PM
No sample codes for Chap 12? cJeffreywang BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 1 May 31st, 2011 07:44 AM
Ch. 4 & Ch. 12 athena BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 23rd, 2004 10:54 AM





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