public JsonResult SaveNewStagePlan(Instruments model) { if (String.IsNullOrEmpty(model.BandName)) { return(Json(new { error = "Please enter a band name" })); } var captcha = new Captcha(); if (!captcha.IsValid(model)) { return(Json(new { error = "The captcha code was not correct" })); } var save = new Save(); var id = save.SaveBand(model.BandName, model.Width, model.Height, -99, model.BandWebAddress, model.BandSocialMediaAddress, model.BandGenre, model.Country, model.WillShowInRecentBands); foreach (var instrument in model.AllInstruments) { //make sure the src is relative, not aboluste due to testing from aboslute path var imgSrc = GetSrc(instrument.Src); IInstrument inst = (Bll.IInstrument)instrument; bool didSave = save.SaveInstrument(inst, id); } var url = new Url().GetUrl(id); //Send notification to Dave and Telis var email = new Email(); //email.SendEmailToDaveAndTelis(GetNewStagePlanAddedNotificationForDaveAndTelis(url, model.BandName), "New stage plan"); if (!String.IsNullOrEmpty(model.TemporaryEmailAddress)) { var content = "<p>Hi " + model.BandName + ",</p><p>Thank you for using stage plan! </p><p>Please take a minute to join us on any of the social media and please do let your friends, band mates and other musicians know about stage plan.</p><p>We also would love to hear direct from you - please let us know how we can make it better for you.</p><p>The unique URL is <a href=\"" + url + "\">" + url + "</a></p><p>Your URL will last for only " + System.Configuration.ConfigurationManager.AppSettings["DaysStagePlanRemains"] + " days. </p><p>Unless you asked us to, we've not signed you up nor have we even stored your email address on our database.</p>"; email.SendEmail(model.TemporaryEmailAddress, null, content, model.BandName + ", your stage plan is ready!"); } if (model.WillSignUp && !String.IsNullOrEmpty(model.TemporaryEmailAddress)) { var controller = new Controllers.HomeController(); var subscription = new SubscriptionPreferences(Request.UserHostAddress); subscription.EmailAddress = model.TemporaryEmailAddress; subscription.Name = model.BandName; subscription.Send(email); } var newPlan = new Bll.NewPlan(); newPlan.New(); return(Json(new { url = url, error = "" })); }
public ActionResult Index(SubscriptionPreferences model) { model.IpAddress = Request.UserHostAddress; var errorMsg = model.Update(); if (String.IsNullOrEmpty(errorMsg)) { var email = new Email(); model.Send(email); return(RedirectToAction("ThankYou", "Home", new { header = "Hurray...it's great you want to join us", msg1 = "Thanks for joining! We need you to do one more thing - Please check your email and you'll see a link to confirm your subscription. If you don't see an email from us please check your spam folder and add us to your white list." })); } else { Utilies.Email.SendFaultEmail("*****@*****.**", "Fault subscribing in to Stage Plan", true, "<p>stageplansp15f35 Could not subscribe: " + model.EmailAddress + " <br/>" + model.Name + "<br />IsOptIn: " + model.IsOptIn + "<br />" + errorMsg); return(RedirectToAction("ThankYou", "Home", new { header = "Oh no...it's great you want to join us but something is wrong...", msg1 = errorMsg })); } }
public ActionResult Index() { var model = new SubscriptionPreferences(Request.UserHostAddress); return(View(model)); }