public IActionResult StudentDetail(int id) { Models.TestNetCoreEFContext context = new Models.TestNetCoreEFContext(); var entity = context.Student.FirstOrDefault(m => m.Id == id); return(View(entity)); }
public IActionResult Add(Models.Student studentEntity) { Models.TestNetCoreEFContext context = new Models.TestNetCoreEFContext(); context.Student.Add(studentEntity); context.SaveChanges(); return(Redirect($"./StudentDetail/{studentEntity.Id}")); }
public IActionResult StudentDetail(Models.Student entity) { Models.TestNetCoreEFContext context = new Models.TestNetCoreEFContext(); context.Entry(entity).State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); return(View(entity)); }
public IActionResult Index() { Models.TestNetCoreEFContext context = new Models.TestNetCoreEFContext(); var StudentList = context.Student.ToList(); return(View(StudentList)); }
public IActionResult Delete(int id) { Models.TestNetCoreEFContext context = new Models.TestNetCoreEFContext(); var entity = context.Student.FirstOrDefault(m => m.Id == id); context.Student.Remove(entity); context.SaveChanges(); return(Redirect("/")); }