public bool Delete() { try { Libercon.Datos.Prestamo pres = Conexion.LiberEntities.Prestamo.First(a => a.IdPrestamo == IdPrestamo); Conexion.LiberEntities.Prestamo.Remove(pres); Conexion.LiberEntities.SaveChanges(); return(true); } catch (Exception) { return(false); } }
public bool Read() { try { Libercon.Datos.Prestamo pres = Conexion.LiberEntities.Prestamo.First(n => n.IdPrestamo == IdPrestamo); IdPrestamo = pres.IdPrestamo; Fecha = pres.Fecha; IdLibro = pres.IdLibro; Titulo = pres.Titulo; IdUsuario = pres.UsuarioId; return(true); } catch (Exception) { return(false); } }
public bool Update() { try { Libercon.Datos.Prestamo pres = Conexion.LiberEntities.Prestamo.First(n => n.IdPrestamo == IdPrestamo); pres.IdPrestamo = IdPrestamo; pres.Fecha = Fecha; pres.IdLibro = IdLibro; pres.Titulo = Titulo; pres.UsuarioId = IdUsuario; return(true); } catch (Exception) { return(false); } }
public bool Create() { try { Libercon.Datos.Prestamo pres = new Libercon.Datos.Prestamo() { IdPrestamo = IdPrestamo, UsuarioId = IdUsuario, IdLibro = IdLibro, Fecha = Fecha, Titulo = Titulo, }; Conexion.LiberEntities.Prestamo.Add(pres); Conexion.LiberEntities.SaveChanges(); return(true); } catch (Exception) { return(false); } }