Ejemplo n.º 1
0
        public async Task <DoctorRate> SaveRate(int id, int answer)
        {
            DataService service = new DataService();
            DoctorRate  dr      = new DoctorRate();

            dr.User_ID          = _userID;
            dr.Doctor_ID        = _doctorId;
            dr.Doc_Quistions_ID = id;
            dr.Answer           = answer.ToString();

            DoctorRate dr1 = await service.createdocrate(dr);

            return(dr1);
        }
Ejemplo n.º 2
0
        internal async Task <DoctorRate> createdocrate(DoctorRate dr1)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://slamtk1.somee.com/api/odata/DoctorRateGet");



            var json = JsonConvert.SerializeObject(dr1);

            var content          = new StringContent(json, Encoding.UTF8, "application/json");
            HttpRequestMessage h = new HttpRequestMessage();

            h.Content    = content;
            h.Method     = HttpMethod.Post;
            h.RequestUri = client.BaseAddress;


            HttpResponseMessage response = await client.SendAsync(h);

            if (response.IsSuccessStatusCode)
            {
                var response1 = await response.Content.ReadAsStringAsync();

                var result = JsonConvert.DeserializeObject <DoctorRate>(response1);
                return(result);
            }
            else
            {
                DoctorRate us2 = new DoctorRate()
                {
                    Doc_Quistions_ID = 0,
                };
                return(us2);
            }
        }