public static List <Articulos> GetList(Expression <Func <Articulos, bool> > filter) { List <Articulos> Lista = null; try { ContextoArt dbase = new ContextoArt(); Lista = dbase.Art.Where(filter).ToList(); } catch (Exception) { throw; } return(Lista); }
public static Articulos Buscar(int Id) { Articulos Articulo = new Articulos(); try { ContextoArt dbase = new ContextoArt(); Articulo = dbase.Art.Find(Id); } catch (Exception) { throw; } return(Articulo); }
public static bool Modificar(Articulos Art) { bool paso = false; try { ContextoArt dbase = new ContextoArt(); dbase.Entry(Art).State = EntityState.Modified; dbase.SaveChanges(); paso = true; } catch (Exception) { throw; } return(paso); }
public static bool Eliminar(int Id) { bool paso = false; try { ContextoArt dbase = new ContextoArt(); Articulos Art = dbase.Art.Find(Id); dbase.Art.Remove(Art); dbase.SaveChanges(); paso = true; } catch (Exception) { throw; } return(paso); }
public static bool Guardar(Articulos Ar) { bool paso = false; try { ContextoArt dbase = new ContextoArt(); dbase.Art.Add(Ar); dbase.SaveChanges(); Arti = Ar; paso = true; } catch (Exception) { throw; } return(paso); }