/// <summary> /// If there is no FirmaPage defined where we expect one, we return a placeholder that indicates one needs to be created, instead of just crashing. /// </summary> /// <param name="firmaPageType"></param> /// <returns></returns> private static FirmaPage MakePlaceholderFirmaPageForDisplay(FirmaPageType firmaPageType) { var firmaPage = new FirmaPage(firmaPageType.FirmaPageTypeID); firmaPage.FirmaPageType = HttpRequestStorage.DatabaseEntities.FirmaPageTypes.GetFirmaPageType(firmaPageType.FirmaPageTypeID); firmaPage.FirmaPageContent = $"[No FirmaPage defined yet for FirmaPageTypeID: {firmaPageType.FirmaPageTypeID} \"{firmaPageType.FirmaPageTypeDisplayName}\" for Tenant {HttpRequestStorage.Tenant.TenantName} (TenantID: {HttpRequestStorage.Tenant.TenantID})]"; return(firmaPage); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public FirmaPageImage(FirmaPage firmaPage, FileResource fileResource) : this() { // Mark this as a new object by setting primary key with special value this.FirmaPageImageID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.FirmaPageID = firmaPage.FirmaPageID; this.FirmaPage = firmaPage; firmaPage.FirmaPageImages.Add(this); this.FileResourceID = fileResource.FileResourceID; this.FileResource = fileResource; fileResource.FirmaPageImages.Add(this); }
public static void DeleteFirmaPage(this IQueryable <FirmaPage> firmaPages, FirmaPage firmaPageToDelete) { DeleteFirmaPage(firmaPages, new List <FirmaPage> { firmaPageToDelete }); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static FirmaPageImage CreateNewBlank(FirmaPage firmaPage, FileResource fileResource) { return(new FirmaPageImage(firmaPage, fileResource)); }