public ActionResult Index(CompleteFormModel model) { if (ModelState.IsValid) { FilterModel filData = TempData["FilterModel"] as FilterModel; var Dob = DateTime.Parse(SqlDateTime.MinValue.ToString()); if (model.Day != 0 && model.Month != 0 && model.Year != 0) { var daysOfMonth = DateTime.DaysInMonth(model.Year, model.Month); if (daysOfMonth < model.Day) { model.Day = daysOfMonth; } Dob = new DateTime(model.Year, model.Month, model.Day); } LifeLead lead = new LifeLead() { Address = model.Address, City = string.Empty, Email = model.Email, FirstName = model.FirstName, GeneratedDateTime = DateTime.Now, HomePhone = model.HomePhone, Source = Session["Source"] as string ?? null, Keyword = Session["Keyword"] as string ?? null, MatchType = Session["Match"] as string ?? null, IpAddress = Session["RemoteIPAddress"] as string ?? null, LastName = model.LastName, PostCode = model.PostCode, ProductName = "Life", SiteId = 1, Status = "New", Title = model.Title, WorkPhone = model.HomePhone ?? model.WorkPhone, CoverAmount = filData.CoverAmount, CoverPeriod = filData.CoverPeriod, ProductType = filData.ProductType, Smoker = model.Smoker, SingleOwnership = filData.SingleOwnership, DOB = Dob, Age = CalculateAge(Dob) }; // var id = _captureService.NewAdminLeadCapture(lead, "http://localhost:3431/dataConverstion/capture"); var id = _captureService.NewAdminLeadCapture(lead, "https://api.websearchmedia.co.uk/dataConverstion/capture"); // var id = _captureService.NewAdminLeadCapture(lead, ""); if (id > 0) { TempData["LeadId"] = id; } else { } return(RedirectToAction("Index", "Thank")); } return(View()); }
public ActionResult Index(FilterModel model) { if (ModelState.IsValid) { var Dob = DateTime.Parse(SqlDateTime.MinValue.ToString()); if (model.Day != 0 && model.Month != 0 && model.Year != 0) { var daysOfMonth = DateTime.DaysInMonth(model.Year, model.Month); if (daysOfMonth < model.Day) { model.Day = daysOfMonth; } Dob = new DateTime(model.Year, model.Month, model.Day); } FuneralLead lead = new FuneralLead() { Address = model.Address, City = string.Empty, Email = model.Email, FirstName = model.FirstName, GeneratedDateTime = DateTime.Now, HomePhone = model.HomePhone, Source = Session["Source"] as string ?? null, Keyword = Session["Keyword"] as string ?? null, MatchType = Session["Match"] as string ?? null, IpAddress = Session["RemoteIPAddress"] as string ?? null, LastName = model.LastName, PostCode = model.PostCode, ProductName = "Funeral", SiteId = 2, Status = "New", Title = model.Title, WorkPhone = model.HomePhone ?? model.WorkPhone, DOB = Dob, Age = CalculateAge(Dob) }; // var id = _captureService.NewAdminLeadCapture(lead, "http://localhost:3431/dataConverstion/capture"); var id = _captureService.NewAdminLeadCapture(lead, "https://api.websearchmedia.co.uk/dataConverstion/capture"); // var id = _captureService.NewAdminLeadCapture(lead, ""); if (id > 0) { TempData["LeadId"] = id; } else { } ThankModel tmodel = new ThankModel() { Title = model.Title, FirstName = model.FirstName, LastName = model.LastName }; TempData["thank"] = tmodel; return(RedirectToAction("Index", "Thank")); } return(View()); }
public ActionResult Index(HealthFilterLeadModel model) { if (ModelState.IsValid) { var Dob = DateTime.Parse(SqlDateTime.MinValue.ToString()); if (model.Day != 0 && model.Month != 0 && model.Year != 0) { var daysOfMonth = DateTime.DaysInMonth(model.Year, model.Month); if (daysOfMonth < model.Day) { model.Day = daysOfMonth; } Dob = new DateTime(model.Year, model.Month, model.Day); } model.Dob = Dob; model.Age = CalculateAge(Dob); HealthLead healthLead = new HealthLead() { CoverTypeId = model.CoverType, FamilyNumber = model.TotalPerson, ExistingPolicy = model.ExistingPolicy,// default Value Smoker = model.Smoker, Title = model.YourTitle, FirstName = model.FirstName, LastName = model.LastName, Dob = Dob, Age = CalculateAge(Dob), HomePhone = model.HomePhone, WorkPhone = model.WorkPhone ?? model.HomePhone, Email = model.Email, Address = model.Address, City = model.City ?? string.Empty, PostCode = model.PostCode, GeneratedDateTime = DateTime.Now, Status = "NEW", SiteId = 3, ProductName = "Health", Source = Session["Source"] as string ?? null, Keyword = Session["Keyword"] as string ?? null, MatchType = Session["Match"] as string ?? null, IpAddress = Session["RemoteIPAddress"] as string ?? null }; //var id = _captureService.NewAdminLeadCapture(healthLead, "http://localhost:3431/dataConverstion/capture"); var id = _captureService.NewAdminLeadCapture(healthLead, "https://api.websearchmedia.co.uk/dataConverstion/capture"); // var id = _captureService.NewAdminLeadCapture(lead, ""); if (id > 0) { TempData["LeadId"] = id; } else { return(View(model)); } ThankModel thank = new ThankModel() { FirstName = model.FirstName, LastName = model.LastName, Title = model.YourTitle }; return(RedirectToAction("Thank", "Home", thank)); } return(View(model)); }