Ejemplo n.º 1
0
        private void AdminMaintenance()
        {
            listBoxAdmins.DataSource = null;
            listBoxAdmins.DataSource = adminLogic.GetAll().ToList();
            listBoxAdmins.SetSelected(0, true);
            Admin admin = (Admin)listBoxAdmins.SelectedItem;

            textBoxCI.Text                  = admin.CI.ToString();
            textBoxName.Text                = admin.Name;
            textBoxSurname.Text             = admin.Surname;
            textBoxEmailMaintenance.Text    = admin.Email;
            textBoxPasswordMaintenance.Text = admin.User.Password;
        }
Ejemplo n.º 2
0
 public IActionResult Get()
 {
     try
     {
         IEnumerable <Admin> adminsInBD     = adminLogic.GetAll();
         List <AdminDTO>     adminsToReturn = new List <AdminDTO>();
         foreach (Admin admin in adminsInBD)
         {
             AdminDTO adminDTO = new AdminDTO(admin);
             adminsToReturn.Add(adminDTO);
         }
         return(Ok(adminsToReturn));
     }
     catch (BusinessLogicException e)
     {
         return(BadRequest(e.Message));
     }
     catch (DataAccessException e)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
     }
 }