
using DbCommon.BusinessCore.DbCore;
using DbCommon.Enties.DbModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DbCommon.BusinessCore.BaseCore
{
    public class MaterialBindingManager : DbContext<MaterialBinding>
    {
        public void Init()
        {
            //If no exist create datebase 
            //Db.DbMaintenance.CreateDatabase();

            var dt = Db.Ado.GetDataTable("SELECT * FROM sysobjects WHERE NAME = 'MaterialBinding'");
            if (dt.Rows.Count == 0)
            {
                //Create tables
                Db.CodeFirst.InitTables(typeof(MaterialBinding));
            }
        }

        public bool Save(MaterialBinding data)
        {
            return Db.Saveable(data).ExecuteCommand() > 0;
        }
    }
}

