public JsonResult GetRecipeById() { string pattern = @"^\s*""?|""?\s*$"; Regex rgx = new Regex(pattern); string recipeId = rgx.Replace(HttpContext.Request.Query["recipeId"].ToString(), ""); Recipe results = _services.GetRecipeById(recipeId); return(new JsonResult(results)); }