// GET: Contact/Delete/5 public ActionResult Delete(Contact_Data IdToDelete) { var d = instance.Contact_Data.Where(x => x.id == IdToDelete.id).FirstOrDefault(); instance.Contact_Data.Remove(d); instance.SaveChanges(); return(RedirectToAction("ContactRecord")); }
//get the record of the Employee to dislplay on loading the database public void OnGet(int?id) { if (id != null) {//get the details after comparing the id var data = (from Contact in Context.Contact_Data where Contact.ID == id select Contact).SingleOrDefault(); contact = data; } }