// GET: Product/Details public ActionResult Details(long productId, int vendorId) { log.Info("Details request"); var model = new ProductDetailsModel(); try { var Url = WebConfigurationManager.AppSettings["MuleESBUrl"]; var request = string.Format("{0}/api/ProductsService/Get?id={1}&vendor={2}", Url, productId, vendorId); HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(request); httpRequest.Method = "GET"; WebResponse response = httpRequest.GetResponse(); model.Product = XmlToProductConverter.convertToProduct(response); } catch (Exception exc) { log.Error("Details request", exc); } return(View(model)); }
// GET: Product/Search public ActionResult SearchProduct(ProductSearchModel model) { log.Info("Request Search"); if (model.SearchParameters != null) { try { var Url = WebConfigurationManager.AppSettings["MuleESBUrl"]; var request = string.Format("{0}/api/ProductsService/Search?searchParameters={1}", Url, model.SearchParameters); HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(request); httpRequest.Method = "GET"; WebResponse response = httpRequest.GetResponse(); model.ProductsList = XmlToProductConverter.convertToProductList(response); } catch (Exception exc) { log.Error("Search Request", exc); } } return(View("Search", model)); }