示例#1
0
        //public void DoWork()
        //{
        //}
        public WCFEmployee GetWCFRESTEmployee(int Id)
        {
            //int IDint = int.Parse(Id);
            WCFEmployee_CFEXDB wcfctxt = new WCFEmployee_CFEXDB();

            //WCFEmployee singleemp = from s in wcfctxt.WCFEmployees.AsQueryable()                                    .Where(s => s.Id == Id)
            //                        select new WCFEmployee
            //                        {
            //                            Id = s.Id,
            //                            Name = s.Name,
            //                            Gender = s.Gender,
            //                            DateOfBirth = s.DateOfBirth,
            //                            EmployeeType = s.EmployeeType,
            //                            AnnualSalary = s.AnnualSalary,
            //                            HourlyPay = s.HourlyPay,
            //                            HoursWorked = s.HoursWorked
            //                        };
            //WCFEmployee singleemp = wcfctxt.WCFEmployees.Find(IDint);

            WCFEmployee singleemp = wcfctxt.WCFEmployees.Find(Id);

            return(singleemp);

            //throw new NotImplementedException();
        }
示例#2
0
        //public void SaveWCFERESTmployee(WCFEmployee Employee)
        //{
        //    WCFEmployee_CFEXDB wcfctxt = new WCFEmployee_CFEXDB();

        //    wcfctxt.WCFEmployees.Add(Employee);
        //    wcfctxt.SaveChanges();

        //    //throw new NotImplementedException();
        //}

        //public string UpdateWCFRESTEmployee(WCFEmployee Employee)
        //{
        //    WCFEmployee_CFEXDB wcfctxt = new WCFEmployee_CFEXDB();
        //    WCFEmployee toupdt = wcfctxt.WCFEmployees.Find(Employee.Id);
        //    toupdt.Name = Employee.Name;
        //    toupdt.Gender = Employee.Gender;
        //    toupdt.DateOfBirth = Employee.DateOfBirth;
        //    toupdt.EmployeeType = Employee.EmployeeType;
        //    toupdt.AnnualSalary = Employee.AnnualSalary;
        //    toupdt.HourlyPay = Employee.HourlyPay;
        //    toupdt.HoursWorked = Employee.HoursWorked;
        //    wcfctxt.SaveChanges();

        //    return toupdt.Name + " details Updated successfully";
        //    //throw new NotImplementedException();
        //}

        public List <WCFEmployee> ALLWCFRESTEmployee()
        {
            WCFEmployee_CFEXDB wcfctxt = new WCFEmployee_CFEXDB();
            List <WCFEmployee> empset  = wcfctxt.WCFEmployees.ToList();

            //IEnumerable<WCFEmployee> empset=from es in wcfctxt.WCFEmployees.AsEnumerable()
            //                                orderby es.Id
            //                                select new WCFEmployee
            //                                {
            //                                    Id = es.Id,
            //                                    Name = es.Name,
            //                                    Gender = es.Gender,
            //                                    DateOfBirth = es.DateOfBirth,
            //                                    EmployeeType = es.EmployeeType,
            //                                    AnnualSalary = es.AnnualSalary,
            //                                    HourlyPay = es.HourlyPay,
            //                                    HoursWorked = es.HoursWorked
            //                                };
            return(empset);
            //throw new NotImplementedException();
        }