Exemplo n.º 1
0
		/// <summary>
		/// Gets the list model for all available sites.
		/// </summary>
		/// <returns>The model</returns>
		public static SiteTreeListModel Get() {
			var m = new SiteTreeListModel();

			using (var db = new DataContext()) {
				m.Sites = db.SiteTrees.OrderBy(s => s.Name).ToList();

				foreach (var site in m.Sites) {
					m.CanDeleteSite.Add(site.Id,
						db.PageDrafts.Where(p => p.SiteTreeId == site.Id && (!p.ParentId.HasValue || p.ParentId.Value != site.Id)).Count() == 0);
				}
			}
			return m;
		}
Exemplo n.º 2
0
        /// <summary>
        /// Gets the list model for all available sites.
        /// </summary>
        /// <returns>The model</returns>
        public static SiteTreeListModel Get()
        {
            var m = new SiteTreeListModel();

            using (var db = new DataContext()) {
                m.Sites = db.SiteTrees.OrderBy(s => s.Name).ToList();

                foreach (var site in m.Sites)
                {
                    m.CanDeleteSite.Add(site.Id,
                                        db.PageDrafts.Where(p => p.SiteTreeId == site.Id && (!p.ParentId.HasValue || p.ParentId.Value != site.Id)).Count() == 0);
                }
            }
            return(m);
        }