예제 #1
0
        public ActionResult Create(CustomerRegistraion customerRegistraion)
        {
            ViewBag.CountryList = new SelectList(GetCountryList(), "CountryID", "CountryName");

            if (ModelState.IsValid)
            {
                db.CustomerRegistraions.Add(customerRegistraion);
                db.SaveChanges();

                //Send to Customer

                MailMessage m = new MailMessage(new MailAddress("*****@*****.**", "Customer Registration"), new MailAddress(customerRegistraion.Email));

                m.Subject = "Registration";
                m.Body    = string.Format("Dear {0}, Thank You For Your Registration. <BR/> Now You Can enjoy all facilities of our online Library!!", customerRegistraion.CustomerName);

                m.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient("smtp.gmail.com");
                smtp.Credentials = new NetworkCredential("*****@*****.**", "01828074472");
                smtp.EnableSsl   = true;
                smtp.Send(m);

                //Send To Authority

                MailMessage mail = new MailMessage(new MailAddress("*****@*****.**", "Customer Registration Info"), new MailAddress("*****@*****.**"));

                mail.Subject    = "New Customer Registration";
                mail.Body       = string.Format("{0} Has Been Registered. <BR/> Some of his/her Information are given below: <BR/> Email : {1} <BR/> Phone : {2} <BR/>", customerRegistraion.CustomerName, customerRegistraion.Email, customerRegistraion.Phone);
                mail.IsBodyHtml = true;
                smtp.Send(mail);

                return(RedirectToAction("Success"));
            }
            return(View());
        }
예제 #2
0
 public ActionResult Create(CustomerRegistraion customer)
 {
     if (ModelState.IsValid)
     {
         db.CustomerRegistraions.Add(customer);
         db.SaveChanges();
         return(RedirectToAction("Success"));
     }
     return(View());
 }