Christoc.Modules.DnnChat.Components.RoomController.GetAllRooms C# (CSharp) Метод

GetAllRooms() публичный Метод

public GetAllRooms ( int moduleId ) : IEnumerable
moduleId int
Результат IEnumerable
        public IEnumerable<Room> GetAllRooms(int moduleId)
        {
            IEnumerable<Room> t;
            using (var ctx = DataContext.Instance())
            {
                var rep = ctx.GetRepository<Room>();
                t = rep.Get(moduleId).OrderBy(x => x.RoomName);
            }
            return t;
        }

Usage Example

Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    var rc = new RoomController();
                    ddlRooms.DataSource = rc.GetAllRooms(ModuleId);
                    ddlRooms.DataBind();

                    var li = new ListItem();
                    li.Value = "-1";
                    li.Text = Localization.GetString("ChooseRoom.Text", LocalResourceFile);
                    ddlRooms.Items.Insert(0, li);

                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }