using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Models { public class DyelotsProvider : IProvider { private BatchDyeingCentralEntities db = new BatchDyeingCentralEntities(); public int Delete(Dyelots t) { if (t == null) return 0; var model = db.Dyelots.ToList().FirstOrDefault(item => t.Dyelot == item.Dyelot); if (model == null) return 0; db.Dyelots.Remove(model); int count = db.SaveChanges(); return count; } public int Insert(Dyelots t) { if (t == null) return 0; if (String.IsNullOrEmpty(t.Dyelot)) return 0; db.Dyelots.Add(t); int count = db.SaveChanges(); return count; } public List Select() { return db.Dyelots.ToList(); } public int Update(Dyelots t) { throw new NotImplementedException(); } } }