Beispiel #1
0
        public TabDTO[] GetAllSharedTabs()
        {
            List <TabDTO> result = new List <TabDTO>();

            try
            {
                RSSDBDataContext dt = new RSSDBDataContext();
                int currentUserID   = GetCurrentUserID();

                var tabs = dt.Shares.Where(share => share.AccountID == currentUserID).Select(_share => _share.Tab);

                List <Tab> list = tabs.ToList();
                foreach (Tab tab in list)
                {
                    TabDTO tabdto = new TabDTO();
                    tabdto.Id            = tab.ID;
                    tabdto.Name          = tab.Name;
                    tabdto.OwnerID       = tab.UserID;
                    tabdto.OwnerUsername = tab.Account.Username;
                    tabdto.ChildCount    = tab.RSSItems.Count;
                    result.Add(tabdto);
                }
            }
            catch
            {
            }
            finally
            {
            }
            return(result.ToArray());
        }
        public TabDTO[] GetAllTabs()
        {
            List<TabDTO> result = new List<TabDTO> ();
            try
            {
                RSSDBDataContext dt = new RSSDBDataContext();
                int currentUserID = GetCurrentUserID();

                var tabs = dt.Tabs.Where(tab => tab.UserID == currentUserID);

                List<Tab> list = tabs.ToList();
                foreach (Tab tab in list)
                {
                    TabDTO tabdto = new TabDTO();
                    tabdto.Id = tab.ID;
                    tabdto.Name = tab.Name;
                    tabdto.OwnerID = tab.UserID;
                    tabdto.OwnerUsername = tab.Account.Username;
                    tabdto.ChildCount = tab.RSSItems.Count;
                    result.Add(tabdto);
                }
            }
            catch
            {

            }
            finally
            {
            }
            return result.ToArray();
        }