public ActionResult Invite(Invite invite) { if (ModelState.IsValid) { if (DataBase.Account.Invite(invite)) return Json(new { response = "success" }, JsonRequestBehavior.AllowGet); return Error(500,"Denied by base"); } if (ModelState["email"].Errors[0].ErrorMessage==GlobalRes.EmailExists) return Json(new { response = "invited" }, JsonRequestBehavior.AllowGet); return Error(400, "bad request"); }
public ActionResult Invite(Invite invite) { if (Request.Cookies["refer"] != null) invite.refer = Request.Cookies["refer"].Value; else invite.refer = "direct"; if (ModelState.IsValid) { DataBase.Account.Invite(invite); return Invited(invite); } return View("Invite",invite); }
public ActionResult Invited(Invite invite) { Response.Cookies.Set(new HttpCookie("refer", "") { Expires = DateTime.Now.AddDays(-1) }); return View("Invited",invite); }
public static bool Invite(Invite invite) { Invites NewInvite = new Invites() { type = invite.type, email = invite.email, date = Time.UNIXNow(), refer = invite.refer, hash = invite.GetHashCode().ToString(), lang = CultureHandler.Current.Get().TwoLetterISOLanguageName }; try { context.Invites.InsertOnSubmit(NewInvite); if (Save()) { application.Server.Mailer.InviteNotification(NewInvite.email, NewInvite.hash); return true; } } catch { } return false; }