Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
how to save and update a record using the same view
Uvie Jakpor
Dec 16 2014 1:41 AM
549
Reply
hello guys,am working on an online admission system where i store records of students in my database.
i have a form where i want to implement a save and update record in the same view insteasd of passing the values to another view for update..here is my code below
if (ModelState.IsValid)
{
student = db.Students.Find(student.ID);
if (student == null)
{
db.Students.Add(student);
}
else
{
db.Entry(student).State = EntityState.Modified;
}
db.SaveChanges();
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
asp.net Gridview not Binding
mvc4 with entity framework tutorial for beginners