Esempio n. 1
0
        public async Task <List <DREsDTO> > GetCodeDreAdm(string userName)
        {
            try
            {
                using (Contexts.SMEManagementContextData db = new Contexts.SMEManagementContextData())
                {
                    var user = db.PrivilegedAccess.Where(x => x.Login == userName).FirstOrDefault();

                    if (user != null && !string.IsNullOrEmpty(user.DreCodeEol))
                    {
                        var dreApi = new DREAPI(endPoint);
                        return(await dreApi.GetDresPorCodigo(user.DreCodeEol, _token));
                    }

                    else
                    {
                        return(null);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        public async Task <List <DREsDTO> > GetListDre()
        {
            try
            {
                var dreApi   = new DREAPI(endPoint);
                var listDres = await dreApi.GetDres(_token);

                if (listDres != null)
                {
                    return(listDres);
                }

                else
                {
                    return(null);
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public async Task <List <EscolasPorDREDTO> > GetListSchoolDre(string dreCodeEol, string schooYear)
        {
            try
            {
                var endPoint    = new EndpointsAPI();
                var schoolApi   = new DREAPI(endPoint);
                var listSchools = await schoolApi.GetEscolasPorDRE(dreCodeEol, _token);

                if (listSchools != null)
                {
                    return(listSchools);
                }

                else
                {
                    return(null);
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }