예제 #1
0
        public ActionResult Create(BusinessLayer.CustomerDetail values)
        {
            if (ModelState.IsValid)
            {
                // try
                //{ Check if this new email already exists on DB
                if (!dbset.ConfirmEmailIsUnique(values.Email.ToString()))
                {
                    var order  = new BusinessLayer.CustomerDetail();
                    var cartid = sc.GetCartId(this.HttpContext);

                    //Create new member into the database
                    sc.CreateMember(values);//customerDetail

                    //send admin an email to call and confirm new user
                    BusinessLayer.SendEmails sendmail = new SendEmails();
                    sendmail.NewCustomerEmail(values);


                    //Update tblUserProfile with correct UserName
                    sc.UpdatetblUserProfileWithCurrentUserName(values.Email.Trim(), cartid);

                    return(RedirectToAction("Index", "ShoppingCart"));
                }
                else
                {
                    ViewBag.StateId = new SelectList(dbset.States, "StateId", "StateName");
                    return(View("NotUniqueEmailIndex"));
                }
            }
            ViewBag.StateId = new SelectList(dbset.States, "StateId", "StateName");

            return(View());
        }