public ActionResult Create(Student student) { if (ModelState.IsValid) { db.Student.AddObject(student); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Create(User model) { if (ModelState.IsValid) { Student student = new Student() { StudentId = model.StudentId, StudentName = model.StudentName, MobileNo = model.MobileNo, Class = model.Class, Gender = model.Gender, LoginId = model.LoginId }; demoEntities.Students.Add(student); demoEntities.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }