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); } }
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); } }
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); } }