// GET: Admin public ActionResult Index() { using (InsuranceEntities db = new InsuranceEntities()) // creates connection to the Db { var insurancequotes = db.AutoInsuranceQuotes.Where(x => x.Removed == null).ToList(); var insuranceQuotesVms = new List <InsuranceVM>(); foreach (var quote in insurancequotes) { var insuranceVm = new InsuranceVM(); insuranceVm.Id = quote.Id; insuranceVm.FirstName = quote.FirstName; insuranceVm.LastName = quote.LastName; insuranceVm.EmailAddress = quote.EmailAddress; insuranceVm.Total = Convert.ToInt32(quote.Total); insuranceQuotesVms.Add(insuranceVm); } return(View(insuranceQuotesVms)); } }
// GET: Admin public ActionResult Admin() { using (dOInsuranceEntities db = new dOInsuranceEntities()) { var memberQuotes = db.InsuranceDBs; var insuranceVMs = new List <InsuranceVM>(); foreach (var preQuote in memberQuotes) { var insureVM = new InsuranceVM(); insureVM.Id = preQuote.Id; insureVM.FirstName = preQuote.FirstName; insureVM.LastName = preQuote.LastName; insureVM.EmailAddress = preQuote.EmailAddress; insureVM.UserQuote = Convert.ToDecimal(preQuote.UserQuote); insuranceVMs.Add(insureVM); } return(View(insuranceVMs)); } }