Exemple #1
0
        public HttpResponseMessage GetAll()
        {
            List <StateModel> staMList = new List <StateModel>();
            List <State>      staList  = dbContext.States.ToList();

            EmployeeController empCon = new EmployeeController();

            for (int i = 0; i < staList.Count; i++)
            {
                StateModel Mod = new StateModel()
                {
                    state = staList[i].Name,
                    ID    = staList[i].StateID
                };
                //for (int z = 0; z < staList[i].Employees.Count; z++)
                //{
                //    EmployeeModel empMod = empCon.Get(staList[i].Employees.ToList()[z].EmployeeID);
                //    Mod.employees.Add(empMod);
                //}
                staMList.Add(Mod);
            }
            return(Request.CreateResponse(HttpStatusCode.OK, staMList));
        }
Exemple #2
0
 public HttpResponseMessage Get(int id)
 {
     try
     {
         State      sta = dbContext.States.Find(id);
         StateModel stm = new StateModel()
         {
             ID    = id,
             state = sta.Name,
         };
         for (int i = 0; i < sta.Employees.Count; i++)
         {
             EmployeeController empCon = new EmployeeController();
             EmployeeModel      EmpMod = empCon.Get(sta.Employees.ToList()[i].EmployeeID);
             stm.employees.Add(EmpMod);
         }
         return(Request.CreateResponse(HttpStatusCode.OK, stm));
     }
     catch
     {
         return(Request.CreateResponse(HttpStatusCode.Conflict));
     }
 }
        public HttpResponseMessage GetAll()
        {
            List <EducationModel> eduMList = new List <EducationModel>();
            List <Education>      eduList  = dbContext.Educations.ToList();

            EmployeeController empCon = new EmployeeController();

            for (int i = 0; i < eduList.Count; i++)
            {
                EducationModel Mod = new EducationModel()
                {
                    eduType = eduList[i].Name,
                    ID      = eduList[i].EducationID
                };
                //for (int z = 0; z < eduList[i].Employees.Count; z++)
                //{
                //    EmployeeModel empMod = empCon.Get(eduList[i].Employees.ToList()[z].EmployeeID);
                //    Mod.employees.Add(empMod);
                //}
                eduMList.Add(Mod);
            }
            return(Request.CreateResponse(HttpStatusCode.OK, eduMList));
        }