Example #1
0
        public static async Task <HttpResponseMessage> GetAll(bool isConfirmed)
        {
            client             = new HttpClient();
            client.BaseAddress = ConstantService.GetUrl();
            client.MaxResponseContentBufferSize = 256000;

            var studentId = App.Current.Properties["id"] as string;

            var route = "";

            if (isConfirmed)
            {
                route = "subject/getall" + "/" + studentId;
            }
            else
            {
                route = "subject/getallUnconfirmed" + "/" + studentId;
            }

            var token = App.Current.Properties["token"] as string;

            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);

            var response = await client.GetAsync(route);

            return(response);
        }
Example #2
0
        public static async Task <HttpResponseMessage> GetNotite(int subjectId)
        {
            client             = new HttpClient();
            client.BaseAddress = ConstantService.GetUrl();
            client.MaxResponseContentBufferSize = 256000;

            var route = "note/getallbysubject" + "/" + subjectId;
            var token = App.Current.Properties["token"] as string;

            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);

            var response = await client.GetAsync(route);

            return(response);
        }
Example #3
0
        public static async Task <HttpResponseMessage> Add(SubjectModel model)
        {
            client             = new HttpClient();
            client.BaseAddress = ConstantService.GetUrl();
            client.MaxResponseContentBufferSize = 256000;

            var route   = "subject/add";
            var json    = JsonConvert.SerializeObject(model);
            var content = new StringContent(json, Encoding.UTF8, "application/json");

            var token = App.Current.Properties["token"] as string;

            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token);

            var response = await client.PostAsync(route, content);

            return(response);
        }
 static AuthService()
 {
     client             = new HttpClient();
     client.BaseAddress = ConstantService.GetUrl();
     client.MaxResponseContentBufferSize = 256000;
 }