You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Models
|
|
{
|
|
public class DyelotsProvider : IProvider<Dyelots>
|
|
{
|
|
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<Dyelots> Select()
|
|
{
|
|
return db.Dyelots.ToList();
|
|
}
|
|
|
|
public int Update(Dyelots t)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|
|
|