static void Main(string[] args) { EmployeeEFDBEntities context = new EmployeeEFDBEntities(); //var employee54 = new Employee() //{ // EmpID = 46, // Name = "Andrew Trolesa", // Salary = 35000, // SSN = 234568, // DeptID = 3 //}; //context.Employees.Add(employee54); //context.SaveChanges(); //var employee16 = new Employee() //{ // EmpID = 47, // Name = "Vujdddfjgyfj", // Salary = 2126, // SSN = 2122, // DeptID = 3 //}; //context.Employees.Add(employee16); //context.SaveChanges(); //LinqToEntity(); //ModifyEmployee(); DeleteEmployee(); }
static void Main(string[] args) { EmployeeEFDBEntities Context = new EmployeeEFDBEntities(); //var Emp = new Employee() //{ // EmpID = 1, // Name = "Rancho", // Salary = 3500, // SSN = 234567, // DepID = 3 //}; //Context.Employees.Add(Emp); //var Emp12 = new Employee() //{ // EmpID = 5, // Name = "James", // Salary = 3800, // SSN = 34567, // DepID = 2 //}; //Context.Employees.Add(Emp12); LinkToEntity(); ModifyEmp(); DeleteEmployee(); }
public static void DeleteEmployee() { EmployeeEFDBEntities context = new EmployeeEFDBEntities(); var employees = context.Employees; var employee = new Employee { EmpID = 7 }; employees.Attach(employee); employees.Remove(employee); context.SaveChanges(); }
public static void LinqToEntity() { EmployeeEFDBEntities context = new EmployeeEFDBEntities(); var employees = context.Employees; var empList = from emp in employees orderby emp.Salary select emp; foreach (var emp in empList) { Console.WriteLine("EmpID:{0},Name:{1},Salary:{2},SSN:{3}", emp.EmpID, emp.Name, emp.Salary, emp.SSN); } }
public static void DeleteEmployee() { EmployeeEFDBEntities Context = new EmployeeEFDBEntities(); var Emp21 = Context.Employees; var e = new Employee { EmpID = 4 }; Emp21.Attach(e); Emp21.Remove(e); }
public static void ModifyEmp() { EmployeeEFDBEntities Context = new EmployeeEFDBEntities(); var Emp21 = Context.Employees; var emplist = from Employee in Emp21 orderby Employee.EmpID select Emp21; foreach (var Employee in Emp21) { if (Employee.EmpID == 1) Employee.Name = "Mathew"; } Context.SaveChanges(); }
public static void LinkToEntity() { EmployeeEFDBEntities Context = new EmployeeEFDBEntities(); var Emp21 = Context.Employees; var emplist = from Employee in Emp21 orderby Employee.EmpID select Emp21; foreach (var Employee in Emp21) { Console.WriteLine("EmpID: {0}, Name: {1}, salary: {2}, SSN: {3} ", Employee.EmpID, Employee.Name, Employee.Salary, Employee.SSN); } }
public static void ModifyEmployee() { EmployeeEFDBEntities context = new EmployeeEFDBEntities(); var employees = context.Employees; var empList = from emp in employees orderby emp.Salary select emp; foreach (var emp in empList) { if (emp.EmpID == 1) { emp.Name = "sreeharibabu"; } } context.SaveChanges(); }
public static void modifyemployee() { EmployeeEFDBEntities context = new EmployeeEFDBEntities(); var employees = context.Employees; var emplist = from emp in employees orderby emp.Salary select emp; foreach (var emp in employees) { if (emp.EmpID == 1) { emp.Name = "johny"; } } context.SaveChanges(); }
static void Main(string[] args) { EmployeeEFDBEntities context = new EmployeeEFDBEntities(); //var Employee = new Employee() //{ // EmpID = 1, // Name = "mohan", // Salary = 28000.00, // SSN = 23456, // DepID = 3 //}; //context.Employees.Add(Employee); //var Employee2 = new Employee() //{ // EmpID = 2, // Name = "vimal", // Salary = 27000.00, // SSN = 24458, // DepID = 3 //}; //context.Employees.Add(Employee2); //var Employee1 = new Employee() //{ // EmpID = 3, // Name = "mtuhin", // Salary = 29000.00, // SSN = 23457, // DepID = 3 //}; //context.Employees.Add(Employee1); //context.SaveChanges(); LinqToEntity(); modifyemployee(); deleteemployee(); }
static void Main(string[] args) { LinqToEntity(); ModifyEmployee(); DeleteEmployee(); EmployeeEFDBEntities context = new EmployeeEFDBEntities(); //var employee = new Employee() //{ // EmpID = 1, // Name = "Andrew Trolesan", // Salary = 35000, // SSN = 23456, // DepID = 3 //}; //context.Employees.Add(employee); //context.SaveChanges(); //var employee2 = new Employee() //{ // EmpID = 2, // Name = "Jeffery Richer", // Salary = 35000, // SSN = 34567, // DepID = 3 //}; //context.Employees.Add(employee2); //var employee3 = new Employee() //{ // EmpID = 3, // Name = "Andrew Trolesan", // Salary = 39000, // SSN = 34567, // DepID = 3 //}; //context.Employees.Add(employee3); context.SaveChanges(); }
static void Main(string[] args) { LinqToEntity(); //ModifyEmployee(); //DeleteEmployee(); EmployeeEFDBEntities context = new EmployeeEFDBEntities(); //var employee = new Employee() //{ // EmpID = 6, // Name = "Andrew Trolesan", // Salary = 35000, // SSN = 2345678, // DepID = 3 //}; //context.Employees.Add(employee); //context.SaveChanges(); //var employee2 = new Employee() //{ // EmpID = 8, // Name = "hari chandana", // Salary = 3000, // SSN = 2345, // DepID = 4 //}; // context.Employees.Add(employee2); //var employee3 = new Employee() //{ // EmpID = 2, // Name = "chandana", // Salary = 13000, // SSN = 234345, // DepID = 6 //}; //context.Employees.Add(employee3); context.SaveChanges(); }