Exemple #1
0
        public void SearchUrl()
        {
            var term = Guid.NewGuid().ToString();
            var data = "/search/member?s=" + term + "&c=organic";

            Assert.AreEqual <string>(data, ProfileCore.SearchUrl(term));
        }
Exemple #2
0
        /// <summary>
        /// Profile Directory
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Unique(Guid?id, string key = null)
        {
            if (!id.HasValue && string.IsNullOrWhiteSpace(key))
            {
                return(RedirectToAction("Index"));
            }

            var callerId = User.IdentifierSafe();

            var profile = new ProfileMaster()
            {
                Display = profileCore.SearchSingle(id, key, callerId),
            };

            if (null != profile.Display)
            {
                profile.Display.Badges = badgeCore.Search(profile.Display.Identifier);

                profile.Display.Activities = activityCore.UserSearch(profile.Display.Identifier);

                profile.Display.Items = itemCore.Search(profile.Display.Identifier, null, null, short.MaxValue, callerId);

                profile.ItemRequests = itemRequestCore.Search(profile.Display.Identifier, callerId);

                profile.Lent = from s in this.borrowCore.Lent(profile.Display.Identifier)
                               where s.Status == BorrowStatus.Returned
                               select s;
                profile.Borrowed = from s in this.borrowCore.Borrowed(profile.Display.Identifier)
                                   where s.Status == BorrowStatus.Returned
                                   select s;

                return(View(profile));
            }
            else if (!string.IsNullOrWhiteSpace(key))
            {
                return(Redirect(ProfileCore.SearchUrl(key, "unknown_key")));
            }
            else
            {
                return(RedirectToAction("index"));
            }
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
        public void SearchUrlNull()
        {
            var data = "/search/member?s=&c=organic";

            Assert.AreEqual <string>(data, ProfileCore.SearchUrl(null));
        }