public bool Delete(TB_AttributeHeaderExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     using (DBEntities DE = new DBEntities())
     {
         var DepObj = DE.TB_AttributeHeader.Where(x => x.ID == model.ID).FirstOrDefault();
         DE.TB_AttributeHeader.Remove(DepObj);
         DE.SaveChanges();
     }
     return status;
 }
 public bool Create(TB_AttributeHeaderExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     DBEntities insertentity = new DBEntities();
     TB_AttributeHeader DepObj = new TB_AttributeHeader();
        // DepObj.ID = model.ID;
     DepObj.Code = model.Code;
     DepObj.Name_en = model.Name;
     DepObj.Sort = Convert.ToInt16(model.Sorts);
     DepObj.Active = model.Active;
     DepObj.OpDateTime = DateTime.Now;
     DepObj.OpUserID = Convert.ToInt64(ctrl.Session["UserID"]);
     insertentity.TB_AttributeHeader.Add(DepObj);
     insertentity.SaveChanges();
     int id = DepObj.ID;
     return status;
 }
        public List<TB_AttributeHeaderExt> GetAllTableValue(int TableID)
        {
            List<TB_AttributeHeaderExt> list = new List<TB_AttributeHeaderExt>();

            DataTable dt = new DataTable();
            SQLCon.Open();
            SqlCommand cmd = new SqlCommand("B_DisplayTable_BizTbl_Table_Sp", SQLCon);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TableID", TableID);
            cmd.Parameters.AddWithValue("@CultureCode", CultureCode);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(dt);
            SQLCon.Close();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    TB_AttributeHeaderExt model = new TB_AttributeHeaderExt();
                    model.ID = Convert.ToInt32(dr["ID"]);
                    model.Code = dr["Code"].ToString();
                    model.Name = dr["Name"].ToString();
                    model.Sorts = dr["Sort"].ToString();
                    model.Active = Convert.ToBoolean(dr["Active"]);
                    list.Add(model);
                }
            }

            return list;
        }
 public bool Update(TB_AttributeHeaderExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     using (DBEntities DE = new DBEntities())
     {
         var DepObj = DE.TB_AttributeHeader.Where(x => x.ID == model.ID).FirstOrDefault();
         DepObj.Code = model.Code;
         DepObj.Name_en = model.Name;
         DepObj.Sort = Convert.ToInt16(model.Sorts);
         DepObj.Active = model.Active;
         DepObj.OpDateTime = DateTime.Now;
         DepObj.OpUserID = Convert.ToInt64(ctrl.Session["UserID"]);
         DE.SaveChanges();
     }
     return status;
 }