public static bool Modificar(CitasDetalles detalle) { using (var conexion = new BeautyCoreDb()) { try { if (Buscar(detalle.Id) != null) { conexion.Entry(detalle).State = EntityState.Modified; if (conexion.SaveChanges() > 0) { return(true); } } else { return(Guardar(detalle)); } } catch (Exception) { throw; } } return(false); }
public static bool Eliminar(CitasDetalles detalle) { using (var conexion = new BeautyCoreDb()) { try { conexion.Entry(detalle).State = EntityState.Deleted; conexion.SaveChanges(); } catch (Exception) { throw; } } return(false); }
public static CitasDetalles Buscar(int nuevoId) { CitasDetalles ID = null; using (var conexion = new BeautyCoreDb()) { try { ID = conexion.CitasDetalles.Find(nuevoId); } catch (Exception) { throw; } } return(ID); }
public static bool Guardar(CitasDetalles detalle) { using (var conexion = new BeautyCoreDb()) { try { conexion.CitasDetalles.Add(detalle); if (conexion.SaveChanges() > 0) { return(true); } } catch (Exception) { throw; } } return(false); }