using System;
using System.Linq;
using System.Web.UI.WebControls;
using Models;
using System.Data;


    public partial class TagList : AdminBase
    {
        
        private DataTable dc = new DataTable();
            protected void Page_Load(object sender, EventArgs e)
            {
                grdbind();
            }

            public void grdbind()
            {
                using (Entities bll = new Entities())
                {
                    //var Bpl = bll.L_Tags;
                    //PagedDataSource pds = new PagedDataSource();
                    //pds.DataSource = Bpl.ToList();  //这里好像一定要Tolist();不然会有点错误；
                  // pds.AllowPaging = true;            
                    this.rptList.DataSource = bll.L_Tags.ToList();
                    this.rptList.DataBind();
                }
            }
            protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
            {
                int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);
                Entities bll = new Entities();
                L_Tags model = bll.L_Tags.First(p => p.TID == id);
                switch (e.CommandName.ToLower())
                {
                        case "del":
                         bll.L_Tags.Remove(model);
                        break;
                }
                bll.SaveChanges();
                grdbind();
              
           }          

        }
  
