namespace ISupply.BLL { public partial class Pipe { private readonly DAL.Pipe _sqLite = new DAL.Pipe(); public void Insert(Model.Pipe model) { if (model == null) return; var entity = ModelToEntity(model); if (!Exits(entity.ID)) { _sqLite.Insert(entity); } else { _sqLite.Update(entity); } } public void Update(Model.Pipe model) { if (model == null) return; var entity = ModelToEntity(model); _sqLite.Update(entity); } public bool Exits(long id) { return _sqLite.Exist(id); } public Model.Pipe Get(long id) { var entity = _sqLite.GetByID(id); var model = EntityToModel(entity); return model; } public List GetAll() { var entitys = _sqLite.GetAll(); var models = EntitysToPipeModels(entitys); return models; } public List GetAllNode() { var entitys = _sqLite.GetAllNode(); var models = EntitysToModels(entitys); return models; } } }