public void createdata(Employee employee) { var context = new EmpContext(); context.Employees.Add(employee); context.SaveChanges(); }
public List <Employee> Getdata() { var context = new EmpContext(); var EmpDetails = context.Employees.ToList(); return(EmpDetails); }
public void DeleteData(int id) { var context = new EmpContext(); var entity = context.Employees.FirstOrDefault(s => s.EmployeeId == id); if (entity != null) { context.Employees.Remove(entity); context.SaveChanges(); } }
public void UpdateData(int id) { var context = new EmpContext(); var entity = context.Employees.FirstOrDefault(s => s.EmployeeId == id); if (entity != null) { entity.EmployeeName = "Neha"; context.Employees.Update(entity); context.SaveChanges(); } }