Exemple #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>());
        }
Exemple #2
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>());
        }
Exemple #3
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>());
        }
Exemple #4
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>());
        }
Exemple #5
0
        public async Task <object> Create([FromBody] Models.Doctor item)
        {
            var doctorJson = new JObject
            {
                { JsonDataConfig.Root, JObject.Parse(JsonConvert.SerializeObject(item, serializerSettings)) }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrl() + JsonDataConfig.Url, doctorJson.ToString());

            return(Empty);
        }
Exemple #6
0
        public async Task <object> Update(string email, [FromBody] List <Models.Patient> item)
        {
            var doctorConfig = JsonDataConfig as Doctor;

            var patientListIdJson = new JArray();

            item.ForEach(x => patientListIdJson.Add(x.Id));

            var patientListJson = new JObject
            {
                { doctorConfig.RootPatients, patientListIdJson }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrl() + JsonDataConfig.Url + "/" + email, patientListJson.ToString());

            return(Empty);
        }