Exemple #1
0
        public IHttpActionResult GetEmployee(int id)
        {
            List <Employee> employees = new List <Employee>();
            var             emp       = db.sp_InsUpdDelEmployees(id, "", "", "", 0, "GetById").ToList();

            //var emp = db.EmployeeInsertUpdateSelectDelete(0, "", "", "", 0, "Select").ToList();
            for (int ii = 0; ii < emp.Count(); ii++)
            {
                if (emp[ii].ID == id)
                {
                    Employee em = new Employee();
                    em.ID        = emp[ii].ID;
                    em.FirstName = emp[ii].FirstName;
                    em.LastName  = emp[ii].LastName;
                    em.Gender    = emp[ii].Gender;
                    em.Salary    = emp[ii].Salary;
                    employees.Add(em);
                }
            }
            return(Ok(employees));
            //var emp = db.Employees.FirstOrDefault(e => e.ID == id);
            //if (emp == null)
            //{
            //    return NotFound();
            //}
            //return Ok(emp);
        }