Esempio n. 1
0
        /// <summary>
        /// List of all Contacts User wise
        /// </summary>
        /// <param name="search">The search parameter.</param>
        /// <returns>action result</returns>
        public ActionResult Index(string search)
        {
            if (ProjectSession.UserID == 0)
            {
                return(RedirectToAction("index", "home"));
            }
            var contacts = _contactBL.GetContactsByUserId(ProjectSession.UserID);

            if (contacts != null)
            {
                contacts = contacts.OrderBy(s => s.FirstName).ToList();
            }
            if (!String.IsNullOrEmpty(search))
            {
                contacts = contacts.Where(s => s.FirstName.ToLower().Contains(search.ToLower()) || s.LastName.ToLower().Contains(search.ToLower())).ToList();
            }
            return(View(contacts));
        }