public static void deleteFactor(int id) { Factor fact = new Factor(); using (adminproyectosEntities db = new adminproyectosEntities()) { var query = (from al in db.Factor where al.idFactor == id select al).Single(); db.Factor.Remove(query); db.SaveChanges(); } }
public static Factor CreateFactor(Factor fact) { Factor factor = new Factor(); using (adminproyectosEntities db = new adminproyectosEntities()) { factor.nombre = fact.nombre; factor.detalle = fact.detalle; factor.estado = fact.estado; db.Factor.Add(factor); db.SaveChanges(); } return(factor); }
public static Factor UpdateFactor(Factor fact) { using (adminproyectosEntities db = new adminproyectosEntities()) { var query = (from al in db.Factor where al.idFactor == fact.idFactor select al).Single(); query.nombre = fact.nombre; query.detalle = fact.detalle; query.estado = fact.estado; db.SaveChanges(); } return(fact); }