// GET: Admin public ActionResult Index() { var applicants = db.Applicants.ToList(); var applicantVms = new List <InsuranceVm>(); foreach (var applicant in applicants) { var applicantVm = new InsuranceVm { ID = applicant.ID, Quote = applicant.Quote, FirstName = applicant.FirstName, LastName = applicant.LastName, EmailAddress = applicant.EmailAddress }; applicantVms.Add(applicantVm); } return(View(applicantVms)); }
// GET: Admin public ActionResult Index() { using (InsuranceEntities db = new InsuranceEntities()) { var customers = db.CustomerInfoes.ToList(); //pulling database info to a new list var customersVms = new List <InsuranceVm>(); //instantiating list foreach (var customer in customers) //looping through list to add customer info to list { var customersVm = new InsuranceVm(); customersVm.FirstName = customer.FirstName; customersVm.LastName = customer.LastName; customersVm.EmailAddress = customer.EmailAddress; customersVm.InsQuote = customer.InsQuote; customersVms.Add(customersVm); } return(View(customersVms)); } }