This commit is contained in:
sc committed 2022-02-20 21:35:10 +08:00
commit 06a4257126
6 files changed
+131 -11

No files matched your search

+13 -3
View File
@@ -8,19 +8,29 @@ namespace Models
{
public class ProductProvider : IProvider<Product>
{
private readonly TicketEntities db = new TicketEntities();
public int Delete(Product t)
{
throw new NotImplementedException();
if (t == null) return 0;
var model = db.Product.ToList().FirstOrDefault(item => t.ProductCode == item.ProductCode);
if (model == null) return 0;
db.Product.Remove(model);
int count = db.SaveChanges();
return count;
}
public int Insert(Product t)
{
throw new NotImplementedException();
if (t == null) return 0;
if (String.IsNullOrEmpty(t.ProductCode)) return 0;
db.Product.Add(t);
int count = db.SaveChanges();
return count;
}
public List<Product> Select()
{
throw new NotImplementedException();
return db.Product.SqlQuery("select * from Product").ToList();//查询
}
public int Update(Product t)