Пример #1
0
        public void SalaryEmployee(int id)
        {
            var db       = new MyDatabaseEntities();
            var employee = db.Employees.Find(id);

            db.SaveChanges();
        }
Пример #2
0
        public void DeleteEmployee(int id)
        {
            var db       = new MyDatabaseEntities();
            var employee = db.Employees.Find(id);

            db.Employees.Remove(employee);
            db.SaveChanges();
        }
Пример #3
0
        public void EditClass(int id, string code, string name, DateTime birthday, string address, string location, int salary)
        {
            var db          = new MyDatabaseEntities();
            var oldEmployee = db.Employees.Find(id);

            oldEmployee.Code            = code;
            oldEmployee.Name            = name;
            oldEmployee.Birthday        = birthday;
            oldEmployee.Address         = address;
            oldEmployee.Location        = location;
            oldEmployee.Salary          = salary;
            db.Entry(oldEmployee).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Пример #4
0
        public void AddEmployee(string code, string name, DateTime birthday, string address, string location, int salary)
        {
            var newEmployee = new Employee();

            newEmployee.Code     = code;
            newEmployee.Name     = name;
            newEmployee.Birthday = birthday;
            newEmployee.Address  = address;
            newEmployee.Location = location;
            newEmployee.Salary   = salary;

            var db = new MyDatabaseEntities();

            db.Employees.Add(newEmployee);
            db.SaveChanges();
        }