Exemplo n.º 1
0
        public SelectList GetPeriodicalTypeSelectList(int id)
        {
            int typeId = id <= 0? 0: service.GetPeriodicalViewModel(id).Type.Id;

            var selectList = new SelectList();

            service.GetPeriodicalTypeViewModelList().ToList()
            .ForEach(type =>
                     selectList.Items.Add(new SelectListItem {
                Value = type.Id, Text = type.Name, Selected = type.Id == typeId
            }));
            return(selectList);
        }
Exemplo n.º 2
0
        public SelectList GetPeriodicalTypeViewModelSelectList()
        {
            var typeList = service.GetPeriodicalTypeViewModelList();

            return(new SelectList(typeList, "Id", "Name"));
        }