Exemple #1
0
        public void createdata(Employee employee)
        {
            var context = new EmpContext();

            context.Employees.Add(employee);
            context.SaveChanges();
        }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        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();
            }
        }