public async void Calificar(object sender, EventArgs e) { EstudiantePutDto estudiantado = new EstudiantePutDto(); estudiantado.NumeroControl = id; estudiantado.PIN = 5484; estudiantado.Calificacion = int.Parse(edtCal.Text); var bandera = await service.PonerMiCalificacion(estudiantado); if (bandera) { Toast.MakeText(this, "Asistencia", ToastLength.Long).Show(); var detallesIntent = new Intent(this, typeof(MainActivity)); StartActivity(detallesIntent); } else { Toast.MakeText(this, "Error", ToastLength.Long).Show(); } }
public async Task <bool> PonerMiCalificacion(EstudiantePutDto datos) { string baseurl = "http://ne2exam2v1.azurewebsites.net/api/Exam3/"; var Client = new HttpClient(); Client.MaxResponseContentBufferSize = 256000; var uril = new Uri(baseurl); var json = JsonConvert.SerializeObject(datos); StringContent content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await Client.PutAsync(uril, content); if (response.IsSuccessStatusCode) { return(true); } else { return(false); } }