Exemplo n.º 1
0
        public Administrator GetAdministratorById(LoginToken <Administrator> token, int id)
        {
            Administrator a = new Administrator();

            if (token != null)
            {
                if (_adminDAO != null)
                {
                    a = _adminDAO.GetById(id);
                }
                else
                {
                    _adminDAO = new AdministratorDAOPGSQL();
                    a         = _adminDAO.GetById(id);
                }
            }
            return(a);
        }
Exemplo n.º 2
0
 public void CreateAdmin(LoginToken <Administrator> token, Administrator admin)
 {
     if (token != null)
     {
         if (token.User.Level == 3)
         {
             if (_adminDAO != null)
             {
                 _adminDAO.Add(admin);
             }
             else
             {
                 _adminDAO = new AdministratorDAOPGSQL();
                 _adminDAO.Add(admin);
             }
         }
         else
         {
             Console.WriteLine("Your level of administration is too low, must be level 3 to add administrator");
         }
     }
 }