示例#1
0
        public ActionResult LabelsDropDown(int storeId = 0, String labelType = "", int[] selectedLabelsId = null)
        {
            var resultList = new List <Label>();

            storeId    = GetStoreId(storeId);
            resultList = LabelRepository.GetStoreLabels(storeId);

            var items = new List <SelectListItem>();

            foreach (var label in resultList)
            {
                items.Add(new SelectListItem {
                    Text = label.Name, Value = label.Id.ToStr(), Selected = selectedLabelsId != null && selectedLabelsId.Contains(label.Id)
                });
            }

            return(PartialView("LabelsDropDown", items));
        }