Example #1
0
        public IList <BlockModel> GetListBlock(string tab, string status)
        {
            try
            {
                var datas      = new List <BlockModel>();
                var blockStore = new BlockStore();
                var dt         = blockStore.GetListBlock(tab, status);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var model = new BlockModel()
                    {
                        ID       = int.Parse(dt.Rows[i]["BLOCK_ID"].ToString()),
                        TITLE    = dt.Rows[i]["BLOCK_TITLE"].ToString(),
                        CONTENT  = HtmlRemoval.StripTagsRegex(dt.Rows[i]["BLOCK_CONTENT"].ToString()),
                        TAB      = dt.Rows[i]["BLOCK_TAB"].ToString(),
                        POSITION = dt.Rows[i]["BLOCK_POSITION"].ToString(),
                        STATUS   = dt.Rows[i]["BLOCK_STATUS"].ToString().Trim() == "1",
                        SECTION  = dt.Rows[i]["BLOCK_SECTION"].ToString(),
                        IMAGE    = dt.Rows[i]["BLOCK_IMAGE"].ToString()
                                   // CREATED_DATE = DateTime.Parse(dt.Rows[i]["CREATED_DATE"].ToString())
                    };
                    datas.Add(model);
                }
                return(datas);
            }

            catch (Exception)
            {
                return(null);
            }
        }