public ActionResult Create(Newsletter newsletter) { if (ModelState.IsValid) { newsletterService.Insert(newsletter); return(RedirectToAction("Index")); } return(View(newsletter)); }
public bool Newsletter(string email) { if (string.IsNullOrEmpty(email)) { return(false); } _newsletterService.Insert(new Newsletter() { Email = email, OptIn = true }); return(true); }
public ActionResult NewsletterSubscribtion(Newsletter newsletter, string controllerName, string actionName) { if (ModelState.IsValid) { var getEmails = newsletterService.GetAll(); if (getEmails.FirstOrDefault(f => f.Email == newsletter.Email) == null) { newsletterService.Insert(newsletter); return(RedirectToAction(actionName, controllerName)); } TempData["Message"] = "Bu E-Posta adresi sisteme kayıtlıdır."; } return(Redirect("/" + controllerName + "/" + actionName + "/#mc_embed_signup")); }