public class HomeController : Controller
{
StudentContext db = new StudentContext();
// GET: Home
public ActionResult Index()
{
var ad =db.Students.ToList();
return View(ad);
}
public ActionResult edit(int id = 0)
{
var data = db.Students.Where(m => m.StudentId == id).FirstOrDefault();
return View(data);
}
[HttpPost]
public ActionResult edit(Student s)
{
db.Entry(s).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}
No comments:
Post a Comment