public ViewResult AllEmployees() { var context = new lnttrainingEntities(); var model = context.EmpTables.ToList(); return(View(model)); }
public ActionResult NewEmployee(EmpTable emp) { var context = new lnttrainingEntities(); context.EmpTables.Add(emp); context.SaveChanges(); return(RedirectToAction("AllEmployees")); }
public ViewResult Find(string id) { int empId = int.Parse(id); var context = new lnttrainingEntities(); var model = context.EmpTables.FirstOrDefault((e) => e.EmpID == empId); return(View(model)); }
public ActionResult Delete(string id) { int empId = int.Parse(id); var context = new lnttrainingEntities(); var model = context.EmpTables.FirstOrDefault((e) => e.EmpID == empId); context.EmpTables.Remove(model); context.SaveChanges(); return(RedirectToAction("AllEmployees")); }
public ActionResult Find(EmpTable emp) { var context = new lnttrainingEntities(); var model = context.EmpTables.FirstOrDefault((e) => e.EmpID == emp.EmpID); model.EmpName = emp.EmpName; model.EmpAddress = emp.EmpAddress; model.EmpSalary = emp.EmpSalary; context.SaveChanges(); return(RedirectToAction("AllEmployees")); }