コード例 #1
0
 public int DeleteUserById(int Id)
 {
     using (WCFServiceEntities tstDb = new WCFServiceEntities())
     {
         Employee usrdtl = new Employee();
         usrdtl.EmployeeID         = Id;
         tstDb.Entry(usrdtl).State = EntityState.Deleted;
         int Retval = tstDb.SaveChanges();
         return(Retval);
     }
 }
コード例 #2
0
        public int UpdateUser(Employee objEmployee)
        {
            using (WCFServiceEntities tstDb = new WCFServiceEntities())
            {
                Employee usrdtl = new Employee();
                usrdtl.EmployeeID         = objEmployee.EmployeeID;
                usrdtl.FirstName          = objEmployee.FirstName;
                usrdtl.LastName           = objEmployee.LastName;
                usrdtl.Position           = objEmployee.Position;
                usrdtl.Office             = objEmployee.Office;
                tstDb.Entry(usrdtl).State = EntityState.Modified;

                int Retval = tstDb.SaveChanges();
                return(Retval);
            }
        }
コード例 #3
0
 public int AddUser(Employee objEmployee)
 {
     using (WCFServiceEntities tstDb = new WCFServiceEntities())
     {
         Employee usrdtl = new Employee();
         usrdtl.EmployeeID = objEmployee.EmployeeID;
         usrdtl.FirstName  = objEmployee.FirstName;
         usrdtl.LastName   = objEmployee.LastName;
         usrdtl.EmpCode    = objEmployee.EmpCode;
         usrdtl.Position   = objEmployee.Position;
         usrdtl.Office     = objEmployee.Office;
         tstDb.Employees.Add(usrdtl);
         int Retval = tstDb.SaveChanges();
         return(Retval);
     }
 }