using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Models { public class PipesProvider : IProvider { private readonly BatchDyeingCentralEntities db = new BatchDyeingCentralEntities(); public int Delete(Pipes t) { if (t == null) return 0; var model = db.Pipes.ToList().FirstOrDefault(item => t.ProductCode == item.ProductCode); if (model == null) return 0; db.Pipes.Remove(model); int count = db.SaveChanges(); return count; } public int Insert(Pipes t) { if (t == null) return 0; if (String.IsNullOrEmpty(t.ProductCode)) return 0; db.Pipes.Add(t); int count = db.SaveChanges(); return count; } public List Select() { string sqlselect = "select * from Pipes "; return db.Pipes.SqlQuery(sqlselect).ToList(); } public List Selectsql(Pipes t) { throw new NotImplementedException(); } public int Update(Pipes t) { throw new NotImplementedException(); } } }