private IEnumerable <SelectListItem> GetTradeMarkSelectList(long TradeMarkID) { TradeMarkDAO tmdao = new TradeMarkDAO(); var trademark = tmdao.GetAllTradeMark(); return(trademark.Select(m => new SelectListItem() { Text = m.Name, Value = m.IDTradeMark.ToString(), Selected = m.IDTradeMark == TradeMarkID })); }
// GET: Admin/TradeMark public ActionResult Index(string KeySearch = "") { if (Session["ADMIN_SESSION"] == null) { return(RedirectToAction("Index", "Login")); } TradeMarkDAO tmdao = new TradeMarkDAO(); CategoryDAO pcdao = new CategoryDAO(); var ListTM = tmdao.GetAllTradeMark(KeySearch); var model = new List <TradeMarkModel>(); foreach (var item in ListTM) { var tmModel = new TradeMarkModel(); var category = pcdao.GetCategoryByID(item.IDCategory); tmModel = TradeMarktoTradeMarkModel(item); tmModel.NameCategory = category.NameCategory; model.Add(tmModel); } return(View(model)); }