Example #1
0
        public IHttpActionResult Register(PreLaunchRegisterToken token)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string refCode = _invitationService.AddToList(token.Email, token.Referrer);

                    var    renderer = new ViewRenderer();
                    string body     = renderer.RenderViewToString("~/Views/Emails/_PreLaunch.cshtml", (object)refCode);

                    _emailService.Send(token.Email, "iiSnap - Thank you for your interest", body, new string[] { "~/Content/Images/logo.png" });

                    return(Ok(refCode));
                }
                catch (Exception ex)
                {
                    return(InternalServerError(ex));
                }
            }

            return(BadRequest(ModelState));
        }