コード例 #1
0
        private void EliminarButton_Click(object sender, RoutedEventArgs e)
        {
            var Context = new PrestamosContexto();

            Context.Prestamos.Remove(prestamos);
            Context.SaveChanges();
            Context.Dispose();
            Limpiar();
        }
コード例 #2
0
        private void BuscarButton_Click(object sender, RoutedEventArgs e)
        {
            var Context  = new PrestamosContexto();
            var registro = Context.Prestamos.Find(prestamos.PrestamosId);

            if (registro != null)
            {
                prestamos        = registro;
                this.DataContext = prestamos;
            }
            Context.Dispose();
        }
コード例 #3
0
        public async Task <bool> GuardarLista(List <Prestamos> personas)
        {
            bool ok = false;

            var Context = new PrestamosContexto();

            foreach (var item in personas)
            {
                Context.Prestamos.UpdateRange(item);
                ok = await Context.SaveChangesAsync() > 0;
            }
            await Context.DisposeAsync();

            return(ok);
        }