Wrox Programmer Forums
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB 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 March 26th, 2015, 05:00 PM
Registered User
Join Date: Mar 2015
Posts: 5
Thanks: 0
Thanked 2 Times in 2 Posts
Default Chapter 15: Page 584. Handcoded.

The new entity framework has depreciated the AddTo(context) function. I had to make the following changes to get the handcoded page to work. If anyone has problems, please feel free to try this. I bolded my change.

protected void btnSave_Click(object sender, EventArgs e)
using(PlanetWroxEntities myEntities = new PlanetWroxEntities())
Review myReview;
if (_id == -1)
myReview = new Review();
myReview.CreateDateTime = DateTime.Now;
myReview.UpdateDateTime = myReview.CreateDateTime;
myReview = (from r in myEntities.Reviews
where r.Id == _id
select r).Single();
myReview.UpdateDateTime = DateTime.Now;
myReview.Title = txtTitle.Text;
myReview.GenreID=Convert.ToInt32(ddlGenre.Selected Value);

The Following User Says Thank You to oceanjams For This Useful Post:
Imar (March 28th, 2015)
Old April 2nd, 2015, 02:06 AM
Registered User
Join Date: Apr 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

This is exceptionally decent and better than average post....You shook posting it....Thanks a ton for posting it.....!!!


Last edited by Jack Gilinsky; January 21st, 2017 at 03:09 AM..

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 15 page 473 dampyr BOOK: Beginning Visual C# 2010 2 December 15th, 2011 05:03 AM
Chapter 16, Page 584 JHubschman BOOK: Beginning ASP.NET 4 : in C# and VB 5 August 26th, 2011 05:56 PM
CHAPTER 15,PAGE 533 dyla BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 5 April 14th, 2010 01:20 PM
CHAPTER 15,PAGE 533 dyla BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 0 April 13th, 2010 10:58 AM
Chapter 15 Page 711 JOHNW BOOK: Beginning ASP 3.0 3 January 14th, 2004 11:14 AM

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