Пример #1
0
        public ActionResult Register(PersonWebServiceReference.Person model)
        {
            int  Id        = 0;
            bool something = false;

            model.User.Role  = (byte)Common.Enums.UserRolesEnum.Candidate;
            model.User.Login = model.Pesel;
            using (var service = new PersonWebServiceReference.PersonsService())
            {
                service.SaveC(model, out Id, out something);
            }

            if (Id != 0)
            {
                // Attempt to register the user
                try
                {
                    FormsAuthentication.SetAuthCookie(model.User.Login, true);
                    return(RedirectToAction("Index", "Home"));
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }
            ModelState.AddModelError("", "Fields cannot be empty or Pesel is already in use!");
            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Пример #2
0
        //
        // GET: /Account/Manage

        public ActionResult Manage()
        {
            PersonWebServiceReference.Person p = null;
            ViewBag.ReturnUrl = Url.Action("Manage");
            using (var service = new PersonWebServiceReference.PersonsService())
            {
                p = service.GerPersonByLogin(this.GetLogin());
            }
            return(View(p));
        }