Пример #1
0
        public int DeleteEmp(int empid)
        {
            EmployeeEntities1 empdb  = new EmployeeEntities1();
            EmployeeDetail    empdtl = new EmployeeDetail();

            empdtl.EmpId = empid;
            empdb.Entry(empdtl).State = System.Data.Entity.EntityState.Deleted;
            int r = empdb.SaveChanges();

            return(r);
        }
Пример #2
0
        public int UpdateEmp(Employee e)
        {
            EmployeeEntities1 empdb  = new EmployeeEntities1();
            EmployeeDetail    empdtl = new EmployeeDetail();

            empdtl.EmpId              = e.empId;
            empdtl.EmpName            = e.empName;
            empdtl.EmpMail            = e.empMail;
            empdtl.EmpPhone           = e.empPhone;
            empdb.Entry(empdtl).State = System.Data.Entity.EntityState.Modified;
            int r = empdb.SaveChanges();

            return(r);
        }
Пример #3
0
        public int AddEmp(Employee emp)
        {
            EmployeeEntities1 empdb  = new EmployeeEntities1();
            EmployeeDetail    empdtl = new EmployeeDetail();

            empdtl.EmpId    = emp.empId;
            empdtl.EmpName  = emp.empName;
            empdtl.EmpMail  = emp.empMail;
            empdtl.EmpPhone = emp.empPhone;
            empdb.EmployeeDetails.Add(empdtl);
            int r = empdb.SaveChanges();

            return(r);
        }