示例#1
0
        public async Task <Models.Patient> Read(int id)
        {
            JObject patientsJson = await APIUtils.GetAsync(IPConfig.GetTotalUrl() + JsonDataConfig.Url + "/" + id);

            return((patientsJson == null) ? null :
                   ((JObject)patientsJson[JsonDataConfig.Root]).GetObject <Models.Patient>());
        }
示例#2
0
        public async Task <TModel> Read(int id, string date)
        {
            JObject json = await APIUtils.GetAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url +
                                                   EndUrl(Request, date));

            return((json == null) ? null : (json[JsonDataConfig.Root] as JObject)?.GetObject <TModel>());
        }
示例#3
0
        public async Task <List <Models.Doctor> > Read()
        {
            var doctorConfig = JsonDataConfig as Doctor;

            JObject doctorsJson = await APIUtils.GetAsync(IPConfig.GetTotalUrl() + doctorConfig.Url);

            return((doctorsJson == null) ? new List <Models.Doctor>() :
                   ((JArray)doctorsJson[doctorConfig.RootDoctors]).GetList <Models.Doctor>());
        }
示例#4
0
        public async Task <List <Models.Patient> > Read()
        {
            var patientConfig = JsonDataConfig as Patient;

            JObject patientsJson = await APIUtils.GetAsync(IPConfig.GetTotalUrl() + patientConfig.Url);

            return((patientsJson == null) ? new List <Models.Patient>() :
                   ((JArray)patientsJson[patientConfig.RootPatients]).GetList <Models.Patient>());
        }
示例#5
0
        public async Task <List <Models.Patient> > Read(string email)
        {
            var doctorConfig = JsonDataConfig as Doctor;

            JObject patientsJson = await APIUtils.GetAsync(IPConfig.GetTotalUrl() + doctorConfig.UrlPatients +
                                                           "?" + QueryParamsConfig.DoctorId + "=" + email);

            return((patientsJson == null) ? new List <Models.Patient>() :
                   ((JArray)patientsJson[doctorConfig.RootPatients]).GetList <Models.Patient>());
        }
示例#6
0
        public async Task <IEnumerable <TrainingKendo> > Read(int id)
        {
            JObject jsonTraining = await APIUtils.GetAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url);

            List <Models.Training> trainings = ((JArray)jsonTraining[JsonDataConfig.Root]).GetList <Models.Training>();

            List <TrainingKendo> trainingsKendo = new List <TrainingKendo>();

            trainings.ForEach(x => trainingsKendo.Add(TrainingKendo.CreateFromOptionList(x)));

            return(trainingsKendo);
        }
        public async Task <IEnumerable <MealKendo> > Read(int id, string day)
        {
            JObject jsonDiet = await APIUtils.GetAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url);

            JObject     jsonDietDay = (JObject)jsonDiet[JsonDataConfig.Root].FirstOrDefault(x => x[JsonDataConfig.Key[0]].ToString() == day);
            List <Meal> meals       = ((JArray)jsonDietDay[JsonDataConfig.Key[1]]).GetList <Meal>();

            List <MealKendo> mealsKendo = new List <MealKendo>();

            meals.ForEach(x => mealsKendo.Add(MealKendo.CreateFromOptionList(x)));

            return(mealsKendo);
        }
示例#8
0
        public async Task <List <TModel> > Read(int id, string date, string period)
        {
            JObject listJson = await APIUtils.GetAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url +
                                                       EndUrl(Request, date, period));

            if (listJson == null)
            {
                return(new List <TModel>());
            }

            return((listJson[JsonDataConfig.Root] as JArray)?.GetList <TModel>() ??
                   new List <TModel>
            {
                (listJson[JsonDataConfig.Root] as JObject)?.GetObject <TModel>()
            });
        }