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 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("/")); }