public ActionResult AboutQuote() { //Let the customer to create a quote if (Session["CustomerId"] == null) { TempData["ReasontoLogin"] = "******"; return(RedirectToAction("loginview", "login")); } int custId = Convert.ToInt32(Session["CustomerId"]); Customer customer = new HealthInsuranceDB().Customers.Find(custId); CustomerQuotePlan CustWithQ = new CustomerQuotePlan() { cust = customer, quote = new Quote(), plan = new Plan() }; ViewBag.City = new HealthInsuranceDB().Cities.Find(customer.CityID).CityName; ViewBag.State = new HealthInsuranceDB().States.Find(customer.CityID).StateName; return(View(CustWithQ)); }
public ActionResult RetrieveQuoteResult() { var DB = new HealthInsuranceDB(); Customer customer = DB.Customers.Find(Convert.ToInt32(Request.Form["customerId"])); Quote q = DB.Quotes.Find(Convert.ToInt32(Request.Form["QuoteId"])); string errorMessage = ""; if (customer == null) { errorMessage = "Sorry, Please Login to see your quote"; } else if (q == null) { errorMessage = "Sorry, We haven't fount any quotes based on your quote id"; } else if (q.CustomerID != customer.CustomerID) { errorMessage = "Sorry, this is not your quote"; } if (errorMessage != "") { ViewBag.error = errorMessage; return(View(customer)); } CustomerQuotePlan CustWithQ = new CustomerQuotePlan() { cust = customer, quote = q, plan = new Plan() }; if (q.StartDate != null) { ViewBag.StartDate = q.StartDate.Value.ToString("yyyy-MM-dd"); } ViewBag.City = DB.Cities.Find(customer.CityID).CityName; ViewBag.State = DB.States.Find(customer.CityID).StateName; return(View("AboutQuote", CustWithQ)); }