public ObjectResult Insert(ClPrestamos client) { try { var prestamo = generic.Insertar(client); return(Ok(prestamo)); } catch (Exception e) { throw e; } }
public ObjectResult Update(ClPrestamos client) { try { var prestamo = generic.Actualizar(client); return(Ok(prestamo)); } catch (Exception e) { throw e; } }
private async void BtnRegistroPrestamo_Clicked(object sender, EventArgs e) { ClPrestamos prestamo = new ClPrestamos { Cli_ID = 1, Prest_Monto = double.Parse(txtMonto.Text), Prest_Interes = double.Parse(txtInteres.Text), Prest_Cuotas = int.Parse(txtCuotas.Text), Prest_FechaCreacion = DateTime.Parse(txtFechaC.Text), Prest_FechaPrimerPago = DateTime.Parse(txtFechaP.Text) }; var client = new HttpClient(); var json = JsonConvert.SerializeObject(prestamo); HttpContent httpContent = new StringContent(json); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); await client.PostAsync(String.Format("https://prestappapi.azurewebsites.net/api/prestamos/insert"), httpContent); await DisplayAlert("Registro correcto", "Se ha registrado el préstamo en PrestApp", "OK"); }