// GET: Admin/Contact public ActionResult Index(string KeySearch) { if (Session["ADMIN_SESSION"] == null) { return(RedirectToAction("Index", "Login")); } var contactDao = new ContactDAO(); var ListContact = contactDao.GetAllContact(KeySearch); var model = new List <ContactModel>(); foreach (var u in ListContact) { var item = new ContactModel(); item.ContactID = u.ContactID; item.Name = u.Name; item.Email = u.Email; item.Message = u.Message; model.Add(item); } return(View(model)); }