public static IEnumerable <TypeEntity> ViewableServerTypes() { return(from t in Navigator.Manager.EntitySettings.Keys let tdn = TypeLogic.TypeToEntity.TryGetC(t) where tdn != null && Navigator.IsViewable(t, null) select tdn); }
protected internal virtual PartialViewResult PartialView(ControllerBase controller, TypeContext tc, string partialViewName) { TypeContext cleanTC = TypeContextUtilities.CleanTypeContext(tc); Type cleanType = cleanTC.UntypedValue.GetType(); if (!Navigator.IsViewable(cleanType, partialViewName)) { throw new Exception(NormalControlMessage.ViewForType0IsNotAllowed.NiceToString().FormatWith(cleanType.Name)); } controller.ViewData.Model = cleanTC; if (Navigator.IsReadOnly(cleanType)) { cleanTC.ReadOnly = true; } cleanTC.ViewOverrides = Navigator.EntitySettings(cleanType).GetViewOverrides(); return(new PartialViewResult { ViewName = partialViewName ?? Navigator.OnPartialViewName((ModifiableEntity)cleanTC.UntypedValue), ViewData = controller.ViewData, TempData = controller.TempData }); }
public static void ConfigureEntityButtons(EntityBase eb, Type cleanType) { eb.Create &= cleanType.IsEmbeddedEntity() ? Navigator.IsCreable(cleanType, isSearch: false) : eb.Implementations.Value.IsByAll ? false : eb.Implementations.Value.Types.Any(t => Navigator.IsCreable(t, isSearch: false)); eb.View &= cleanType.IsEmbeddedEntity() ? Navigator.IsViewable(cleanType, eb.PartialViewName) : eb.Implementations.Value.IsByAll ? true : eb.Implementations.Value.Types.Any(t => Navigator.IsViewable(t, eb.PartialViewName)); eb.Navigate &= cleanType.IsEmbeddedEntity() ? Navigator.IsNavigable(cleanType, eb.PartialViewName, isSearch: false) : eb.Implementations.Value.IsByAll ? true : eb.Implementations.Value.Types.Any(t => Navigator.IsNavigable(t, eb.PartialViewName, isSearch: false)); eb.Find &= cleanType.IsEmbeddedEntity() ? false : eb.Implementations.Value.IsByAll ? false : eb.Implementations.Value.Types.Any(t => Navigator.IsFindable(t)); }