public static string PicturePageUrl(this UserSettings settings, Guid contentGuid) { var db = Db.Context().Result; var possiblePhotoContent = db.PhotoContents.SingleOrDefault(x => x.ContentId == contentGuid); if (possiblePhotoContent != null) { return(settings.PhotoPageUrl(possiblePhotoContent)); } var possibleImageContent = db.ImageContents.SingleOrDefault(x => x.ContentId == contentGuid); if (possibleImageContent != null) { return(settings.ImagePageUrl(possibleImageContent)); } return(string.Empty); }
public static async Task <string> ContentUrl(this UserSettings settings, Guid toLink) { var db = await Db.Context(); var possiblePost = await db.PostContents.SingleOrDefaultAsync(x => x.ContentId == toLink); if (possiblePost != null) { return(settings.PostPageUrl(possiblePost)); } var possibleFile = await db.FileContents.SingleOrDefaultAsync(x => x.ContentId == toLink); if (possibleFile != null) { return(settings.FilePageUrl(possibleFile)); } var possiblePhoto = await db.PhotoContents.SingleOrDefaultAsync(x => x.ContentId == toLink); if (possiblePhoto != null) { return(settings.PhotoPageUrl(possiblePhoto)); } var possibleImage = await db.ImageContents.SingleOrDefaultAsync(x => x.ContentId == toLink); if (possibleImage != null) { return(settings.ImagePageUrl(possibleImage)); } var possibleNote = await db.NoteContents.SingleOrDefaultAsync(x => x.ContentId == toLink); if (possibleNote != null) { return(settings.NotePageUrl(possibleNote)); } return(string.Empty); }