The errata list is a list of errors and their corrections that were found after the product was released.
The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.
Version |
Location |
Description |
Submitted by |
Date submitted |
ePub |
Page fig1-11
United States |
The url of figure 1-11 should read auctions/details/1234
|
Christopher |
May 22, 2013 |
PDF, ePub |
United Kingdom |
On Page 19(PDF), and in same location on epub format, there appears to be left over mark up.
This communication occurs through the use of +ActionResult+s, the return values which every controller action is expected to provide
|
Mike Hingley |
Jun 30, 2014 |
PDF |
Page 16
Figure 1-6 |
In the flow chart in figure 1-6, two arrows leave the "Route found" diamond, both leading to a different "Route is processed" rectangle. It seems like one arrow should be labeled "Yes" and the other labeled "No" and lead to a "Error message generated" rectangle.
|
Andreas Yankopolus |
Oct 02, 2012 |
ePub |
Page 32
Code listing for ActionResult About |
This line in the code listing will not compile:
ViewBag.Username = User.Identity.Username;
should be
ViewBag.Username = User.Identity.Name;
|
Mark Geller |
Sep 27, 2012 |
PDF |
Page 33
Last code snippet |
The code appears wrong.
@model Auction should be @model CompanyInfo
|
Anonymous |
Sep 29, 2012 |
PDF |
Page 33
Code sample in "Strongly typed views" section |
The code section starts with "@Model Auction", but I think that it should read "@Model CompanyInfo" given the subsequent data access.
|
Andreas Yankopolus |
Oct 02, 2012 |
PDF |
Page 33
6th paragrph |
the line reads :
This example modifies the previous Auction.cshtml example
Should Read:
This example modifies the previous About.cshtml example
|
steven mandel |
Jan 17, 2013 |
ePub |
Page 37
ActionResult Details snippet just before "The View" |
The snippet that is supposed to be added refers to a model class that has not been added to the project unless the accompanying code project was downloaded. If you are following along by creating the project yourself then the instructions in the previous "Models" section only says to look at the snippet and not actually add it to the project.
Additionally, if you have manually added the model class to the project in VS2012 then the default namespace for the model is going to likely be "Ebuy.Models.Auction" or "Ebuy.Models.AuctionModel" instead of the listed "Ebuy.Website.Models.Auction".
|
Nathan Stohlmann |
Nov 21, 2012 |
ePub |
Page 37
United States |
In the "Putting It All Together" section before the controller is created the model class Auction should be added as follows:
public class Auction
{
public long ID { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public decimal StartPrice { get; set; }
public decimal CurrentPrice { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
}
Note that the ID field is not the same as the snippet to correspond with the spelling in the controller.
Also, the project must be built before the view can be made from the Auction class.
|
Christopher |
May 22, 2013 |
ePub |
Page 57
Handling Form Posts |
Chapter 3
Handling Form Posts
The book says to use the following code in for the Auction Create controller.... which gave me an error.
[HttpPost]
public ActionResult Create(Auction auction)
{
// Create Auction in database
return View(auction);
}
Changed to the following to get it working.
[HttpPost]
public ActionResult Create(Ebuy.Website.Models.Auction auction)
{
// Create Auction in DB
return View(auction);
}
Perhaps this is something to do with my install.
Cheers
|
Jim D |
Dec 14, 2012 |
PDF |
Page 57
Bulding a form |
When the book instructs you to add a view it doesn't tell you which folder to create the view in, secondly it does not tell you to make the view strongly typed, with out doing this the following code from the book will not work
<h2>Create Auction</h2>
@using (Html.BeginForm())
{
<p>
@Html.LabelFor(model => model.Title)
@Html.EditorFor(model => model.Title)
</p>
<p>
@Html.LabelFor(model => model.Description)
@Html.EditorFor(model => model.Description)
</p>
<p>
@Html.LabelFor(model => model.StartPrice)
@Html.EditorFor(model => model.StartPrice)
</p>
<p>
@Html.LabelFor(model => model.EndTime)
@Html.EditorFor(model => model.EndTime)
</p>
<p>
<input type="submit" value="Create"/>
</p>
}
You need to add @model Ebuy.Website.Models.Auction at the top of the page so it looks like this:
@model Ebuy.Website.Models.Auction
@{
ViewBag.Title = "Create";
}
<h2>Create Auction</h2>
@using (Html.BeginForm())
{
<p>
@Html.LabelFor(model => model.Title)
@Html.EditorFor(model => model.Title)
</p>
<p>
@Html.LabelFor(model => model.Description)
@Html.EditorFor(model => model.Description)
</p>
<p>
@Html.LabelFor(model => model.StartPrice)
@Html.EditorFor(model => model.StartPrice)
</p>
<p>
@Html.LabelFor(model => model.EndTime)
@Html.EditorFor(model => model.EndTime)
</p>
<p>
<input type="submit" value="Create"/>
</p>
}
You should create the view in the /views/Auctions/
it also doesn't tell you which controller to make the changes to (you may already have the controller by the way) - The controller is /controllers/AuctionsController.cs
Hope that helps
|
Ayo |
Apr 15, 2013 |
Printed |
Page 59
Handling Form Posts |
Make these changes to the AuctionController.cs file. You may need to comment out the Create controller that was automatically created. Use this code:
[HttpPost]
public ActionResult Create(Ebuy.Website.Models.Auction auction)
{
//Create Auction in Database.
return View(auction);
}
|
Kevin MacDonald |
Aug 06, 2013 |
ePub |
Page 61
Specifying Business Rules with Data Annotations, Valid Ranges, StartPrice snippet |
Text specifies:
[Range(1,10000]
public decimal StartPrice { get; set; }
and so is missing an end paren. It should be:
[Range(1,10000)]
public decimal StartPrice { get; set; }
|
Nathan Stohlmann |
Nov 21, 2012 |
PDF |
Page 61
Second code fragment |
This code fails because auction.StartTime has not been initialized and has the value 0, which represents January 1, 0001. That date is invalid in SQL Server where the minimum date is January 1, 1753.
var db = new EbuyDataContext();
db.Auctions.Add(auction);
db.SaveChanges();
|
James Mauldin |
Jun 28, 2013 |
Printed |
Page 61
Creating a Data Access Layer with Entity Framework Code First |
Both the DbContext Code and the Create Controller wont work. The DbContext needs to have the Auction class path specified. The controller needs to define the StartTime or the SQL fails.
using System.Data.Entity;
public class EbuyDataContext :DbContext
{
public DbSet<Ebuy.Website.Models.Auction> Auctions { get; set; }
}
THE CONTROLLER:
[HttpPost]
public ActionResult Create(Ebuy.Website.Models.Auction auction)
{
//Create Auction in Database.
var db = new EbuyDataContext();
auction.StartTime = DateTime.Now;
db.Auctions.Add(auction);
db.SaveChanges();
return View(auction);
}
|
Kevin MacDonald |
Aug 06, 2013 |
ePub |
Page 62
United States |
This is what the book says the final result should look like. It is missing several lines of required code.
public class Auction
{
[Required]
[StringLength(50,
ErrorMessage = "Title cannot be longer than 50 characters")]
public string Title { get; set; }
[Required]
public string Description { get; set; }
[Range(1, 10000,
ErrorMessage = "The auction's starting price must be at least 1")]
public decimal StartPrice { get; set; }
public decimal CurrentPrice { get; set; }
public DateTime EndTime { get; set; }
}
This is what it should be:
public class Auction
{
public long Id { get; set;}
[Required]
[StringLength(50,
ErrorMessage = "Title cannot be longer than 50 characters")]
public string Title { get; set; }
[Required]
public string Description { get; set; }
[Range(1, 10000,
ErrorMessage = "The auction's starting price must be at least 1")]
public decimal StartPrice { get; set; }
public decimal CurrentPrice { get; set; }
public DateTime StartTime { get; set; }
[Range(typeof(DateTime),"1/1/2012","12/31/9999")]
public DateTime EndTime { get; set; }
}
With all these corrections we should get some free books or something :)
|
Christopher |
May 23, 2013 |
Printed |
Page 105
code after 4th paragraph |
The IRepository interface should be as follows:
public interface IRepository<T>
{
T GetById(string id);
void Delete(T entity);
void Save(T entity);
}
|
John J Smith |
Nov 08, 2012 |
Printed |
Page 106
Code Section |
IErrorLogger Interface method should be defined as:
public void Log(Exception e)
|
Winson Kwok |
Nov 01, 2012 |
Printed |
Page 149
Last line |
MIME type "text.html" should be "text/html"
|
Kevin Smith |
Apr 11, 2013 |
Printed |
Page 164
Paragraph after first code snippet |
It's
"Notice, too, how the class overrides the equal operators..."
but the class in the code snippet doesn't override the equal operator...
|
Emanuele Prato |
Feb 16, 2013 |
Printed |
Page 167
Last snippet of code |
IList<Product> GetProductsByCategory(Category item) method in the last line.
It's
return resut;
msut be
return result;
|
Emanuele |
Feb 16, 2013 |
Printed |
Page 227
3rd line from bottom |
"width-device-width" should be "width=device-width", as shown in the last line.
|
Kevin Smith |
Apr 11, 2013 |
ePub |
Page 306
about 3rd paragraph (hard to be exact in ebook version) |
The section on jquery.validate claims that these are the only 2 script references you need in your view for things to work
<script src='@Url.Content("~/Scripts/jquery.validate.js")' type='text/javascript'></script>
<script src='@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")' type='text/javascript'></script>
However, it does nothing with just those 2 references. The page was still posting back to the server for validation there. To get it working, this script reference is needed in addition to the 2 above (unless maybe if you have this script reference below in the layout, which the book had not said to do).
<script src="~/Scripts/jquery-1.7.1.js" type="text/javascript"></script>
|
Anonymous |
Jun 24, 2013 |