Esempio n. 1
0
        public ActionResult PeopleSearch(string id)
        {
            if (id != "")
            {
                List<AccountModel> result = getSearchList(id);

                int pageSize = 6;
                int pCount = 0;
                if (result.Count % pageSize == 0)
                {
                    pCount = result.Count / pageSize;
                }
                else
                    pCount = result.Count / pageSize + 1;
                var list = result.Take(pageSize).ToList();
                AccountCollection ac = new AccountCollection { Accounts = list, CurrentPage = 1, Info = id, PagesCount = pCount };
                return View(ac);
            }
            return View();
        }
Esempio n. 2
0
        public ActionResult Recommend(int id, int uid)
        {
            List<KeyValuePair<int, List<string>>> output = Recommender.Get(uid);
            foreach (var item in output)
            {
                while (item.Value.Contains(string.Empty))
                {
                    item.Value.Remove(string.Empty);
                }
            }
            List<AccountModel> people = new List<AccountModel>();

            using (var db = new RazomContext())
            {
                output.ForEach(o => {
                    Users u = db.Users.Find(o.Key);
                    people.Add(new AccountModel
                    {
                        Associations = o.Value,
                        EMail = u.Email,
                        FirstName = u.FirstName,
                        SecondName = u.SecondName,
                        ID = u.UserID,
                        Login = u.Login
                    });
                });
            }
            AccountCollection ac = new AccountCollection { Accounts = people };
            return View(new PeopleAddForm { TripID = id, AccountsInfo = ac });
        }
Esempio n. 3
0
        public ActionResult PagerPeopleSearch(FormCollection form)
        {
            string id = form["id"].ToString();
            int page = int.Parse(form["page"].ToString());
            List<AccountModel> result = getSearchList(id);
            int pageSize = 6;
            int pCount = 0;
            if (result.Count % pageSize == 0)
            {
                pCount = result.Count / pageSize;
            }
            else
                pCount = result.Count / pageSize + 1;

            var list = result.Skip((page - 1) * pageSize).Take(pageSize).ToList();
            AccountCollection pc = new AccountCollection() { Accounts = list, CurrentPage = page, PagesCount = pCount, Info = id };
            return View("PeopleSearch", pc);
        }