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.
50 lines
1.2 KiB
50 lines
1.2 KiB
|
4 years ago
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Linq;
|
||
|
|
using System.Text;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
|
||
|
|
namespace Models
|
||
|
|
{
|
||
|
|
public class PipesProvider : IProvider<Pipes>
|
||
|
|
{
|
||
|
|
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<Pipes> Select()
|
||
|
|
{
|
||
|
|
string sqlselect = "select * from Pipes ";
|
||
|
|
return db.Pipes.SqlQuery(sqlselect).ToList();
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<Pipes> Selectsql(Pipes t)
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
|
||
|
|
public int Update(Pipes t)
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|