コード例 #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);
            }
        }
コード例 #2
0
        public ActionResult RegisterIndex(LogonRegisterContainerModel model)
        {
            PersonModel profileModel = new PersonModel();

            profileModel.Email = model.Register.Email;
            profileModel.FirstName = model.Register.Name;
            profileModel.LastName = model.Register.Surename;

            ViewBag.ListCountry = businessLayer.ListAllCountries();

            return View("../Profile/Create",profileModel);
        }
コード例 #3
0
        public ActionResult Edit(PersonModel model)
        {
            try
            {
                string email = HttpContext.User.Identity.Name;

                int userId = businessLayer.GetProfile(email).Id;

                businessLayer.EditPerson(userId, model.FirstName, model.LastName, model.Email, model.Address1, model.Address2,
                                             model.PostalCode, model.City, model.CountryId, model.BirthDate);

                return RedirectToAction("Details");
            }
            catch
            {
                return View();
            }
        }