// // GET: /Home/Details/5 public ActionResult Details(int id) { SampleContext db = new SampleContext(); tblEmployee emplo = db.tblEmployee.Single(x => x.Id == id); //ViewData["EmployeeData"] = emplo; //@Html.Display("EmployeeData") return View(emplo); }
public ActionResult Edit(tblEmployee emplo) { try { SampleContext db = new SampleContext(); if (ModelState.IsValid) { db.tblEmployee.Attach(emplo); db.ObjectStateManager.ChangeObjectState(emplo, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } else { return View(); } } catch { return View(); } }
// // GET: /Home/Edit/5 public ActionResult Edit(int id) { SampleContext db = new SampleContext(); tblEmployee employee = db.tblEmployee.Single(x => x.Id == id); return View(employee); }
// // GET: /Home/ public ActionResult Index() { SampleContext db = new SampleContext(); return View(db.tblEmployee.ToList()); }