public void testRolesSelect() { IMembershipRepository m = new MembershipRepository(); SelectList sl = new SelectList(m.getAllRoles()); Assert.AreEqual(sl.First().Text, "hello"); }
public static string GetSubjectNameById(int id) { var select = new SelectList( SubjectList, "value", "text", 0); return select.First(x => Convert.ToInt32(x.Value) == id).Text; }
public MenuViewModel(User user) { Pools = new SelectList(user.GetPools(),"Id","Name").ToList(); Teams = new List<Team>(); //foreach (var pool in user.GetPools()) // Pools.Add(new SelectListItem() { Text = pool.Name, Value = pool.Id.ToString() }); if (Pools.Count != 0) { SelectedPoolId = Int32.Parse(Pools.First().Value); Teams = new ApplicationDbContext().TeamsByPoolID(SelectedPoolId); } }
public void testAllCommittees() { IGenericRepository generic = new GenericRepository(); IMeetingLibRepository mlib = new MeetingLibRepository(); // IList<TblMeetingLib> coms = generic.getAllMeetings(); //IList<SelectItems> items = generic.getAllCommitteesSelect(); IList<SelectItems> items = generic.getAllMeetingsSelect(); IList<MeetingLib> itemsm = mlib.getAllMeetingLibs(); SelectList sl = new SelectList(itemsm, "MeetingLibID", "MeetingLibDesc"); Assert.AreEqual(sl.First().Text,"hello"); }
public ActionResult ManageSiteCategories(string tenantTypeId) { IUser currentUser = UserContext.CurrentUser; if (currentUser == null) return HttpNotFound(); var authorizer = DIContainer.Resolve<Authorizer>(); pageResourceManager.InsertTitlePart("站点类别管理"); List<TenantType> managedTenantTypes = new List<TenantType>(); IEnumerable<TenantType> allTenantTypes = tenantTypeService.Gets(MultiTenantServiceKeys.Instance().SiteCategory()); foreach (var tenantType in allTenantTypes) { if (authorizer.IsAdministrator(tenantType.ApplicationId)) { managedTenantTypes.Add(tenantType); } } SelectList tenantList = new SelectList(managedTenantTypes.Select(n => new { text = n.Name, value = n.TenantTypeId }), "value", "text", tenantTypeId); if (string.IsNullOrEmpty(tenantTypeId)) { tenantTypeId = tenantList.First().Value; } IEnumerable<Category> categorys = categoryService.GetOwnerCategories(0, tenantTypeId); ViewData["tenantList"] = tenantList; ViewData["tenantTypeId"] = tenantTypeId; return View(categorys); }