public static AwardingBody GetAwardingBody(int id, string language) { var request = AppServices.CreateNonAuthorizedRequest(Method.GET); string finalUrl = $"{AppServices.BaseUri}awardingbodies/{language}/{id}"; var client = new RestClient($"{finalUrl}"); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { return(JsonConvert.DeserializeObject <AwardingBody>(response.Content)); } return(null); //return (new AwardingBody { Id = 1, ActiveLanguage = new AwardingBodyLanguage() { AwardingBodyId = 1, Name = "Υπουργείο Οικονομίας, Υποδομών, Ναυτιλίας και Τουρισμού - Ανώτερη Σχολή Τουριστικής Εκπαίδευσης Ρόδο" } }); }
public static QualificationType GetQualificationType(int id, string language) { var request = AppServices.CreateNonAuthorizedRequest(Method.GET); string finalUrl = $"{AppServices.BaseUri}qualificationtype/{language}/{id}"; var client = new RestClient($"{finalUrl}"); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { return(JsonConvert.DeserializeObject <QualificationType>(response.Content)); } return(null); // return (new QualificationType { Id = 3, EducationalLevel = new EducationalLevel() { Id = 3, LevelId = 53, EQFLevel = 28 }, ActiveLanguage = new QualificationTypeLanguage() { QualificationTypeId = 53, Name = "Απολυτήριο Επαγγελματικού Λυκείου (ΕΠΑ.Λ.)" } }); }
public static EducationalSector GetEducationalSector(int id, string language) { var request = AppServices.CreateNonAuthorizedRequest(Method.GET); string finalUrl = $"{AppServices.BaseUri}sector/{language}/{id}"; var client = new RestClient($"{finalUrl}"); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { return(JsonConvert.DeserializeObject <EducationalSector>(response.Content)); } return(null); }
public static Qualification GetQualification(int id, string language) { var request = AppServices.CreateNonAuthorizedRequest(Method.GET); string finalUrl = $"{AppServices.BaseUri}qualifications/{language}/{id}"; var client = new RestClient($"{finalUrl}"); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { return(JsonConvert.DeserializeObject <Qualification>(response.Content)); } return(null); // return (new Qualification() { Id = 1, QualificationTypeId = 61, EducationalLevelId = 2, EducationalLevel = new EducationalLevel() { Id = 28, EQFLevel = 4, LevelId = 4 } }); }
public static EducationalLevel GetEducationalLevel(int id, string language) { var request = AppServices.CreateNonAuthorizedRequest(Method.GET); string finalUrl = $"{AppServices.BaseUri}educationallevel/{language}/{id}"; var client = new RestClient($"{finalUrl}"); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { var level = JsonConvert.DeserializeObject <EducationalLevel>(response.Content); return(level); } return(null); // return (new EducationalLevel { Id = 1, EQFLevel = 1, LevelId = 1, ActiveLanguage = new EducationalLevelLanguage() { Name = "name1", Skills = "skills1", Knowledge = "know1", Competence = "comp1" } }); }
public static IList <EducationalSector> GetEducationalSectors(string language) { try { var request = AppServices.CreateNonAuthorizedRequest(Method.GET); var finalUri = $"{AppServices.BaseUri}sector/{language}"; var client = new RestClient(finalUri); IRestResponse response = client.Execute(request); if (response.IsSuccessful || response.StatusCode == System.Net.HttpStatusCode.OK) { var categories = JsonConvert.DeserializeObject <IList <EducationalSector> >(response.Content); return(categories); } return(new List <EducationalSector>()); } catch (Exception e) { throw new Exception(e.Message); } }
public static IList <Qualification> GetQualificationsByCriteria(string language, int?levelId, int?bodyId, int?sectorId, int?typeId, string text) { var queryString = "?"; if (levelId != null && Convert.ToInt32(levelId) > 0) { if (queryString.Length > 1) { queryString += $"&levelId={Convert.ToInt32(levelId)}"; } else { queryString += $"levelId={Convert.ToInt32(levelId)}"; } } if (bodyId != null && Convert.ToInt32(bodyId) > 0) { if (queryString.Length > 1) { queryString += $"&bodyId={Convert.ToInt32(bodyId)}"; } else { queryString += $"bodyId={Convert.ToInt32(bodyId)}"; } } if (sectorId != null && Convert.ToInt32(sectorId) > 0) { if (queryString.Length > 1) { queryString += $"§orId={Convert.ToInt32(sectorId)}"; } else { queryString += $"sectorId={Convert.ToInt32(sectorId)}"; } } if (typeId != null && Convert.ToInt32(typeId) > 0) { if (queryString.Length > 1) { queryString += $"&typeId={Convert.ToInt32(typeId)}"; } else { queryString += $"typeId={Convert.ToInt32(typeId)}"; } } if (!string.IsNullOrEmpty(text)) { if (queryString.Length > 1) { queryString += $"&text={text}"; } else { queryString += $"text={text}"; } } var request = AppServices.CreateNonAuthorizedRequest(Method.GET); string finalUrl = $"{AppServices.BaseUri}qualifications/filter/{language}{queryString}"; var client = new RestClient($"{finalUrl}"); IRestResponse response = client.Execute(request); if (response.IsSuccessful) { return(JsonConvert.DeserializeObject <IList <Qualification> >(response.Content)); } return(null); // return (new Qualification() { Id = 1, QualificationTypeId = 61, EducationalLevelId = 2, EducationalLevel = new EducationalLevel() { Id = 28, EQFLevel = 4, LevelId = 4 } }); }