Exemplo n.º 1
0
        public BlockModel GetBlockById(string id)
        {
            try
            {
                var blockStore = new BlockStore();
                var dt         = blockStore.GetBlockById(id);
                var model      = new BlockModel();
                if (dt.Rows.Count == 0)
                {
                    return(null);
                }
                model.ID       = int.Parse(dt.Rows[0]["BLOCK_ID"].ToString());
                model.TITLE    = dt.Rows[0]["BLOCK_TITLE"].ToString();
                model.CONTENT  = dt.Rows[0]["BLOCK_CONTENT"].ToString();
                model.TAB      = dt.Rows[0]["BLOCK_TAB"].ToString();
                model.POSITION = dt.Rows[0]["BLOCK_POSITION"].ToString();
                model.STATUS   = dt.Rows[0]["BLOCK_STATUS"].ToString() == "1";
                model.SECTION  = dt.Rows[0]["BLOCK_SECTION"].ToString();
                model.IMAGE    = dt.Rows[0]["BLOCK_IMAGE"].ToString();
                return(model);
            }

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