public void SearchUrl() { var term = Guid.NewGuid().ToString(); var data = "/search/offer?s=" + term + "&c=organic"; Assert.AreEqual <string>(data, ItemCore.SearchUrl(term)); }
public static string RelativeSearch(this IReferenceType reference, string query) { switch (reference.Type) { case Reference.ItemRequest: return(ItemRequestCore.SearchUrl(query)); case Reference.Item: return(ItemCore.SearchUrl(query)); case Reference.User: return(ProfileCore.SearchUrl(query)); case Reference.Company: return(CompanyCore.SearchUrl(query)); default: return(null); } }
public void SearchUrlNull() { var data = "/search/offer?s=&c=organic"; Assert.AreEqual <string>(data, ItemCore.SearchUrl(null)); }
// // GET: /item/{Key} public ActionResult Unique(Guid?id = null, string key = null) { if (!id.HasValue && string.IsNullOrWhiteSpace(key)) { return(RedirectToAction("Index")); } var callerId = User.IdentifierSafe(); var master = new ItemMaster() { Display = itemCore.GetItem(id, key, callerId), }; if (null != master.Display) { master.Display.SetCategories(); var dic = new Dictionary <Guid, ItemShare>(); foreach (var s in from s in borrowCore.Shares(master.Display) where s.Status == BorrowStatus.Returned select s) { if (!dic.ContainsKey(s.RequesterUserIdentifier)) { dic.Add(s.RequesterUserIdentifier, s); } } master.Display.Shares = dic.Values; var relatedProductQuery = string.Empty; if (null != master.Display.Categories && 0 < master.Display.Categories.Count()) { relatedProductQuery = string.Join(" ", master.Display.Categories); relatedProductQuery.Replace('#', (char)0); } else if (!string.IsNullOrWhiteSpace(master.Display.Title)) { relatedProductQuery = master.Display.Title; } if (!string.IsNullOrWhiteSpace(relatedProductQuery)) { master.Results = from i in this.luceneCore.Search(relatedProductQuery, callerId, 6, Reference.Item) where i.Key != key select i; } if (null != master.Display.Categories && (from c in master.Display.Categories where c.ToLower() == "book" || c.ToLower() == "books" select c).Count() > 0) { master.Display.ExternalReviews = this.goodReadsCore.GetReviewToken(master.Display.Title); } return(View(master)); } else if (!string.IsNullOrWhiteSpace(key)) { return(Redirect(ItemCore.SearchUrl(key, "unknown_key"))); } else { return(RedirectToAction("Index")); } }