Example #1
0
        private async void cargarListaPersonasDpto()
        {
            List <Department> listaDepartamentos;
            List <Person>     listaPersonas;

            List <PersonDepartmentName> listaPersonasNombreDepartamento = new List <PersonDepartmentName>();

            //Creamos un diccionario para almacenar la id de cada departamento asociada
            //con su nombre

            IDictionary <int, string> dict = new Dictionary <int, string>();

            listaDepartamentos = await DepartmentHandlerBL.getDepartmentList();

            foreach (Department item in listaDepartamentos)
            {
                dict[item.ID] = item.Name;
            }

            //Usando el objeto Persona traido de la api , junto con el diccionario
            //para realizar la asignación idDepartamento => nombreDepartamento, construimos
            //una lista de objetos PersonasNombreDepartamento

            listaPersonas = await PersonHandlerBL.getPersonListBL();

            foreach (Person item in listaPersonas)
            {
                listaPersonasNombreDepartamento.Add(new PersonDepartmentName(item, dict[item.DepartmentID]));
            }

            //Asignamos a la variable de la clase la lista recien construida
            listaPersonasDpto = new ObservableCollection <PersonDepartmentName>(listaPersonasNombreDepartamento);
        }
Example #2
0
 // PUT: api/Departments/5
 public void Put(int id, [FromBody] Department nuevoDepartamento)
 {
     try
     {
         DepartmentHandlerBL handler = new DepartmentHandlerBL();
         handler.updateDepartment(nuevoDepartamento);
     }
     catch (Exception e)
     {
         //Conexión con las otras capas fallida
         throw new HttpResponseException(HttpStatusCode.ServiceUnavailable);
     }
 }
Example #3
0
 // DELETE: api/Departments/5
 public void Delete(int id)
 {
     try
     {
         DepartmentHandlerBL handler = new DepartmentHandlerBL();
         handler.deleteDepartment(id);
     }
     catch (Exception e)
     {
         //Conexión con las otras capas fallida
         throw new HttpResponseException(HttpStatusCode.ServiceUnavailable);
     }
 }
Example #4
0
        /* public VMActualizacionEmpleado(PersonDepartmentName persona)
         * {
         *   //Se ponen los valores por defecto en los inputs de la vista y se carga el listado de departamentos
         *   //del Picker
         *
         *   InputPerson = persona;
         *
         *
         * }*/

        private async void cargarListaDpto()
        {
            DepartmentList = await DepartmentHandlerBL.getDepartmentList();
        }