// GET: Ping public ActionResult Index(PingListItem name, string search) { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new PingService(userId); var model = service.GetPings(); if (search != null) { return(View(model.Where(x => x.PingLocation.StartsWith(search, StringComparison.OrdinalIgnoreCase) || search == null).ToList())); } else { return(View(model)); } }