public async Task <IActionResult> GetRecipe(string recipeId, [FromQuery] string?projectPath = null) { if (string.IsNullOrEmpty(recipeId)) { return(BadRequest($"A Recipe ID was not provided.")); } ProjectDefinition?projectDefinition = null; if (!string.IsNullOrEmpty(projectPath)) { projectDefinition = await _projectDefinitionParser.Parse(projectPath); } var recipeDefinitions = await RecipeHandler.GetRecipeDefinitions(_customRecipeLocator, projectDefinition); var selectedRecipeDefinition = recipeDefinitions.FirstOrDefault(x => x.Id.Equals(recipeId)); if (selectedRecipeDefinition == null) { return(BadRequest($"Recipe ID {recipeId} not found.")); } var output = new RecipeSummary( selectedRecipeDefinition.Id, selectedRecipeDefinition.Version, selectedRecipeDefinition.Name, selectedRecipeDefinition.Description, selectedRecipeDefinition.ShortDescription, selectedRecipeDefinition.TargetService, selectedRecipeDefinition.DeploymentType.ToString(), selectedRecipeDefinition.DeploymentBundle.ToString() ); return(Ok(output)); }
/// <summary> /// ctor the Mighty /// </summary> public RecipeCommentEmailMessage(IWebSettings webSettings, RecipeSummary recipeSummary, string commenterUsername, UserSummary userToNotify) { RecipeSummary = recipeSummary; CommenterUsername = commenterUsername; UserToNotify = userToNotify; this.SenderAddress = webSettings.SenderAddress; this.SenderDisplayName = webSettings.SenderDisplayName; this.ToRecipients.Add(userToNotify.EmailAddress); // Build Subject if (recipeSummary.CreatedBy == userToNotify.UserId) { this.Subject = string.Format("{0} commented on your recipe, {1}", commenterUsername, recipeSummary.RecipeName); } else { this.Subject = string.Format("{0} also left a comment on the recipe, {1}", commenterUsername, recipeSummary.RecipeName); } }