public ActionResult Getlist(string name, string Notes, int listid, int companyid, string emailaddes) { var data = new List <ContactDetails>(); try { var contactdata = context.SpContactFilterClient(listid, companyid, User.Identity.Name).ToList(); if (contactdata.Count() > 0) { var companyname = context.SPgetCompdetailsbycompid(companyid).FirstOrDefault().name; data = (from con in contactdata where ((name == null || name == "") || con.contactfullname.ToUpper().Contains(name.ToUpper())) && ((Notes == null || Notes == "") || con.contactnotes.Trim().Replace("\r", "").Replace("\n", "").Replace(System.Environment.NewLine, "").Replace(" ", "").Contains(Notes.Trim().Replace("\r", "").Replace("\n", "").Replace(System.Environment.NewLine, "").Replace(" ", ""))) select new ContactDetails { contactid = con.contactid, companyid = con.companyid, contactfullname = con.contactfullname, titlestandard = con.titlestandard, contactphone = con.contactphone, contactcellphone = con.contactcellphone, contactemail = con.contactemail, listid = listid, linkedinprofileurl = con.linkedinprofileurl, combinednotes = con.contactnotes, compname = companyname, contactnotes = con.contactnotes, Userid = con.Userid }).Distinct().ToList(); ViewBag.ConEmail = emailaddes; } } catch (Exception ex) { cm.ErrorExceptionLogingByService(ex.ToString(), "ProspectViewCompanyClient" + ":" + new StackTrace().GetFrame(0).GetMethod().Name, "Getlist", "NA", "NA", "NA", "WEB"); } return(View(data)); }