Ejemplo n.º 1
0
        public ActionResult Create(PersonModel model)
        {
            try
            {
                businessLayer.CreatePerson(model.FirstName,model.LastName,model.Email,model.Password,
                    model.Address1,model.Address2,model.BirthDate,model.PostalCode,model.City, model.Country ,"user");

                IFormsAuthenticationService FormsService = new FormsAuthenticationService();
                FormsService.SignIn(model.Email, false);

                Response.Cookies["UserFullName"].Value = model.FirstName + " " + model.LastName;

                return RedirectToAction("MyAccount","Home");
            }
            catch
            {
                ModelState.AddModelError("", "ERROR");
                ViewBag.ListCountry = businessLayer.ListAllCountries();
                return View(model);
            }
        }
        protected override void Initialize(RequestContext requestContext)
        {
            if (FormsService == null) { FormsService = new FormsAuthenticationService(); }
            if (MembershipService == null) { MembershipService = new AccountMembershipService(); }

            base.Initialize(requestContext);
        }