Friday, 15 June 2012

asp.net mvc 3 - Add New Post using ID = -1 in Entity Framework -



asp.net mvc 3 - Add New Post using ID = -1 in Entity Framework -

i have learning asp.net mvc 3 , entity framework video tutorials. have been searching propose of passing -1 id in new post object. insert new id database or else. using entity framework. , it's working , have run code , insert -1 id in database.

public post getpost(int? id) { homecoming id.hasvalue ? model.posts.where(x => x.id == id).first() : new post() { id = -1 }; }

asp.net-mvc-3 entity-framework

No comments:

Post a Comment