Exemplo n.º 1
0
        public ActionResult Index(string name, string email, string nameOfBusiness, string address, string city, string state,
            string zip, string phone, string industry, string relatedServices, string password, string paymentInfo)
        {
            try
               {
              var dao = new MerchantDao();
              var m = dao.Create(email, password);

              m.Name = name;
              m.NameOfBusiness = nameOfBusiness;
              m.Address = address;
              m.City = city;
              m.State = state;
              m.Zip = zip;
              m.Phone = phone;
              m.Industry = null; // industry;
              m.IndustryRelated = null; // relatedServices;
              m.PaymentInfo = paymentInfo;
              dao.Update(m);

              // Send the confirmation email here
              var emailFields = new
              {
                 ConfirmUrl = Url.Action("Index", "signin", new { id = m.Id }, "http")
              };
              var emailBody = Email.BodyFromTemplateFile(Server.MapPath("~/Emails/signup_confirmation.htm"), emailFields);

              if (utils.Email.Send("Merchant Beat SingUp confirmation", emailBody, new string[] { m.Email }, new string[] { }))
              {
                 return RedirectToAction("signedup", new { id = m.Id });
              }
              else
              {
                 throw new Exception("SignUp Confirmation email sending failed");
              }
               }
               catch (Exception)
               {
              return RedirectToAction("Index", "Home");
               }
        }