public JsonResult AddEmailNewsletter(string email, string genre) { if (!String.IsNullOrWhiteSpace(email) && !String.IsNullOrWhiteSpace(genre)) { var newsletter = new Newsletter {Email = email, Sexo = genre}; var existingNewsletter = new NewsletterService().GetRecords(n => n.Email.ToLower().Equals(email.ToLower())).FirstOrDefault(); if (existingNewsletter != null) { return Json(new JsonRequestResult { ResultType = JsonRequestResultType.Alert, Message = Resources.Resource.Newsletter_Signup_Subscribe_DuplicatedMail }); } new NewsletterService().InsertObject(newsletter); return Json(new JsonRequestResult { ResultType = JsonRequestResultType.Success, Message = Resources.Resource.Newsletter_Signup_Subscribe_Successful}); } return Json(new JsonRequestResult { ResultType = JsonRequestResultType.Alert, Message = Resources.Resource.Newsletter_Signup_Subscribe_Error }); }
/// <summary> /// Create a new Newsletter object. /// </summary> /// <param name="idEmailNewsletter">Initial value of the IdEmailNewsletter property.</param> /// <param name="email">Initial value of the Email property.</param> /// <param name="sexo">Initial value of the Sexo property.</param> public static Newsletter CreateNewsletter(global::System.Int32 idEmailNewsletter, global::System.String email, global::System.String sexo) { Newsletter newsletter = new Newsletter(); newsletter.IdEmailNewsletter = idEmailNewsletter; newsletter.Email = email; newsletter.Sexo = sexo; return newsletter; }
/// <summary> /// Deprecated Method for adding a new object to the Newsletter EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToNewsletter(Newsletter newsletter) { base.AddObject("Newsletter", newsletter); }