public ActionResult IngredientMatchControl(string xmlingredientid)
 {
     try
     {
         IngredientCandidates candidates = new IngredientCandidates();
         var repo = new MatchedItemRepository_pp();
         var xmlingredient = repo.GetXmlIngredient(xmlingredientid);
         if ( xmlingredient != null )
             candidates = repo.GetIngredientCandidates(xmlingredient);
         candidates.XmlIngredient = xmlingredient;
         return View (candidates);
     }
     catch (Exception e)
     {
         return Content("<p><div class=\"error-message\">Unable to find candidates, verify the menu item is matched.</div></p>");
     }
 }
        public IngredientCandidates GetIngredientCandidates(XmlImportIngredient ingredient)
        {
            var candidates = new IngredientCandidates();

            candidates.ByNameCandidates = GetIngredientCandidatesByName(ingredient.ItemIngredientName);

            var xmlmenuitem = GetXmlImportMenuItemByMenuItemId(ingredient.XmlImportMenuItemId.ToString());
            if (xmlmenuitem != null)
            {
                var menuxref = GetMenuCrossReference(xmlmenuitem.ItemGuid);
                if (menuxref != null)
                    candidates.ByPreviousCandidates = GetIngredientCandidatesByPrevious(menuxref.menuitemguid.ToString());
            }
            return candidates;
        }