public ActionResult MatchAggregate(string xmlguid, string menuitemguid) { var repo = new MatchedItemRepository_pp(); var aggregate = new XmlMenuItem(); if ( !string.IsNullOrEmpty(xmlguid)) { aggregate = repo.GetXmlMenuItemWithIngredients(xmlguid); foreach (var xmlIngredient in aggregate.Ingredients) { //need to get ingredient match, different from menu item ingredients var xref = repo.GetIngredientCrossReference(xmlIngredient.ItemIngredientGuid); if (xref != null && xref.ingredientsguid != null) // means there is no match xmlIngredient.IngredientMatch = repo.GetMatchedIngredient(xref.ingredientsguid.ToString(),true); // // if ( xmlIngredient.IngredientMatch == null) // xmlIngredient.IngredientMatch = new IngredientAggregate(); } } if (string.IsNullOrEmpty(menuitemguid)) { //attempt to get from xref var xref = repo.GetMenuCrossReference(xmlguid); menuitemguid = xref.menuitemguid.ToString(); } if (!string.IsNullOrEmpty(menuitemguid)) aggregate.MenuItemMatch = repo.GetMenuItemWithIngredients(menuitemguid); return View(aggregate); }
public ActionResult GetIngredientDetails(string ingredientId) { var repo = new MatchedItemRepository_pp(); var results = repo.GetMatchedIngredient(ingredientId, false); return View(results); }
public ActionResult UpdateIngredientMatch(string xmlguid,string matchedGuid) { var repo = new MatchedItemRepository_pp(); var response = "Ingredient Updated to " + matchedGuid; try { if (!repo.UpdateIngredientXref(xmlguid, matchedGuid)) response = "Unable to update Ingredient"; } catch (Exception e) { response = "Oops, an error occured. Details: " + e.Message; } var ingredient = repo.GetXmlIngredientByGuid(xmlguid); ingredient.IngredientMatch = repo.GetMatchedIngredient(matchedGuid, true); return PartialView("GetIngredientDetails", ingredient); return Content(response); }