/// <summary> /// Executes the View for Export /// </summary> public ActionResult BeerXml(int recipeId) { var recipe = this.RecipeService.GetRecipeById(recipeId); if (recipe == null) { return(this.Issue404()); } var xmlString = this.BeerXmlExporter.Export(recipe); var xmlBytes = Encoding.Default.GetBytes(xmlString); var disposition = new ContentDisposition { // for example foo.bak FileName = string.Format("{0}-brewgr.xml", StringCleaner.CleanForUrl(recipe.RecipeName)), // always prompt the user for downloading, set to true if you want // the browser to try to show the file inline Inline = false, }; Response.AppendHeader("Content-Disposition", disposition.ToString()); return(new FileStreamResult(new MemoryStream(xmlBytes), "text/xml")); }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildBrewSessionDetailUrl(BrewSession brewSession) { var brewSessionNameForUrl = StringCleaner.CleanForUrl(brewSession.RecipeSummary.RecipeName); brewSessionNameForUrl += "-brew-session"; return(string.Format("/brew/{0}/{1}", brewSession.BrewSessionId, brewSessionNameForUrl)); }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildBrewSessionDetailUrl(BrewSession brewSession) { var brewSessionNameForUrl = StringCleaner.CleanForUrl(brewSession.RecipeSummary.RecipeName); brewSessionNameForUrl += "-brew-session"; return(string.Format("{0}/brew/{1}/{2}", this.WebSettings.RootPath, brewSession.BrewSessionId, brewSessionNameForUrl)); }
/// <summary> /// Creates a Recipe Detail Url /// </summary> public static string RecipeDetailUrl(this UrlHelper urlHelper, int recipeId, string recipeName, string styleName) { // NOTE: This code duplicated in Brewgr.Web.Core.Model.RecipeUrlBuilder if (!string.IsNullOrWhiteSpace(styleName) && styleName.ToLower() != "unknown style") { recipeName += "-" + StringCleaner.CleanForUrl(styleName); } if (!recipeName.ToLower().Trim().EndsWith("recipe")) { recipeName += "-recipe"; } return(urlHelper.Action("RecipeDetail", "Recipe", new { recipeId, recipename = StringCleaner.CleanForUrl(recipeName) })); }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildDetailUrl(RecipeSummary recipeSummary) { // NOTE: This Code Duplicated in Brewgr.Web UrlHelperExtensions var recipeNameForUrl = StringCleaner.CleanForUrl(recipeSummary.RecipeName); if (!string.IsNullOrWhiteSpace(recipeSummary.BJCPStyleName) && recipeSummary.BJCPStyleName.ToLower() != "unknown style") { recipeNameForUrl += "-" + StringCleaner.CleanForUrl(recipeSummary.BJCPStyleName); } if (!recipeNameForUrl.ToLower().Trim().EndsWith("recipe")) { recipeNameForUrl += "-recipe"; } return(string.Format("/recipe/{0}/{1}", recipeSummary.RecipeId, recipeNameForUrl)); }
/// <summary> /// Creates a recipe brew detail url /// </summary> public static string BrewSessionDetailUrl(this UrlHelper urlHelper, int brewSessionId, string recipeName) { return(urlHelper.Action("BrewSessionDetail", "BrewSession", new { brewSessionId = brewSessionId, recipename = StringCleaner.CleanForUrl(recipeName) })); }
/// <summary> /// Creates a Adjunct Detail Url /// </summary> public static string AdjunctDetailUrl(this UrlHelper urlHelper, int adjunctId, string name) { return(urlHelper.Action("AdjunctDetail", "Ingredient", new { ingredientId = adjunctId, name = StringCleaner.CleanForUrl(name) })); }
/// <summary> /// Creates a Hop Detail Url /// </summary> public static string HopDetailUrl(this UrlHelper urlHelper, int hopId, string name) { return(urlHelper.Action("HopDetail", "Ingredient", new { ingredientId = hopId, name = StringCleaner.CleanForUrl(name) })); }
/// <summary> /// Creates a Fermentable Detail Url /// </summary> public static string FermentableDetailUrl(this UrlHelper urlHelper, int fermentableId, string name) { return(urlHelper.Action("FermentableDetail", "Ingredient", new { ingredientId = fermentableId, name = StringCleaner.CleanForUrl(name) })); }
/// <summary> /// Creates a Recipe Brew Sessions link /// </summary> public static string RecipeBrewSessionsUrl(this UrlHelper urlHelper, int recipeId, string recipeName) { return(urlHelper.Action("RecipeBrewSessions", "Recipe", new { recipeId = recipeId, recipeName = StringCleaner.CleanForUrl(recipeName) })); }
/// <summary> /// Builds a user profile url /// </summary> public string BuildUserProfileUrl(string username) { // NOTE: This Code Duplicated in Brewgr.Web UrlHelperExtensions return(string.Format("/!/{1}", StringCleaner.CleanForUrl(username))); }
/// <summary> /// Creates a Yeast Detail Url /// </summary> public static string YeastDetailUrl(this UrlHelper urlHelper, int yeastId, string name) { return(urlHelper.Action("YeastDetail", "Ingredient", new { ingredientId = yeastId, name = StringCleaner.CleanForUrl(name) }, "http")); }