public IList <BlockModel> GetListBlockFont(string section) { try { var datas = new List <BlockModel>(); var blockStore = new BlockStore(); var dt = blockStore.GetListBlockFont(section); 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); } }
public IList <FontBlockViewModel> GetListBlockFont(string section) { try { var datas = new List <FontBlockViewModel>(); var blockStore = new BlockStore(); var dt = blockStore.GetListBlockFont(section); var listFrontModelTab1 = new FontBlockViewModel(); var listFrontModelTab2 = new FontBlockViewModel(); var listFrontModelTab3 = new FontBlockViewModel(); var listModel1 = new List <BlockModel>(); var listModel2 = new List <BlockModel>(); var listModel3 = new List <BlockModel>(); var model = new BlockModel(); for (int i = 0; i < dt.Rows.Count; i++) { switch (int.Parse(dt.Rows[i]["BLOCK_TAB"].ToString())) { case 1: model = new BlockModel() { ID = int.Parse(dt.Rows[i]["BLOCK_ID"].ToString()), TITLE = dt.Rows[i]["BLOCK_TITLE"].ToString(), CONTENT = 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", IMAGE = dt.Rows[i]["BLOCK_IMAGE"].ToString() }; listModel1.Add(model); listFrontModelTab1.Id = 1; break; case 2: model = new BlockModel() { ID = int.Parse(dt.Rows[i]["BLOCK_ID"].ToString()), TITLE = dt.Rows[i]["BLOCK_TITLE"].ToString(), CONTENT = 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", IMAGE = dt.Rows[i]["BLOCK_IMAGE"].ToString() // CREATED_DATE = DateTime.Parse(dt.Rows[i]["CREATED_DATE"].ToString()) }; listModel2.Add(model); listFrontModelTab2.Id = 2; break; } } listFrontModelTab1.ListBlockFeature = listModel1; listFrontModelTab2.ListBlockFeature = listModel2; datas.Add(listFrontModelTab1); datas.Add(listFrontModelTab2); return(datas); } catch (Exception ex) { return(null); } }