示例#1
0
        /// <summary>
        /// Create a new OpenId object.
        /// </summary>
        /// <param name="openIdId">Initial value of the OpenIdId property.</param>
        /// <param name="userId">Initial value of the UserId property.</param>
        /// <param name="openIdUrl">Initial value of the OpenIdUrl property.</param>
        public static OpenId CreateOpenId(global::System.Int32 openIdId, global::System.Int32 userId, global::System.String openIdUrl)
        {
            OpenId openId = new OpenId();

            openId.OpenIdId  = openIdId;
            openId.UserId    = userId;
            openId.OpenIdUrl = openIdUrl;
            return(openId);
        }
示例#2
0
        /// <summary>
        /// Adds a new OpenId to the database.
        /// </summary>
        /// <param name="openid">OpenId to be added.</param>
        public void AddOpenId(OpenId openid)
        {
            Contract.Requires <ArgumentNullException>(openid != null);

            userDb.OpenIds.AddObject(openid);
        }
示例#3
0
 /// <summary>
 /// Create a new OpenId object.
 /// </summary>
 /// <param name="openIdId">Initial value of the OpenIdId property.</param>
 /// <param name="userId">Initial value of the UserId property.</param>
 /// <param name="openIdUrl">Initial value of the OpenIdUrl property.</param>
 public static OpenId CreateOpenId(global::System.Int32 openIdId, global::System.Int32 userId, global::System.String openIdUrl)
 {
     OpenId openId = new OpenId();
     openId.OpenIdId = openIdId;
     openId.UserId = userId;
     openId.OpenIdUrl = openIdUrl;
     return openId;
 }
示例#4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the OpenIds EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOpenIds(OpenId openId)
 {
     base.AddObject("OpenIds", openId);
 }
示例#5
0
        public ActionResult Register(User user, string identifier, string returnUrl, bool rememberMe)
        {
            //The registration form has been submitted
            try
            {
                if (ModelState.IsValid)
                {
                    OpenId openid = new OpenId
                    {
                        OpenIdUrl = identifier,
                        User = user
                    };

                    users.AddOpenId(openid);
                    users.SaveChanges();

                    // Now let's login out user to out application
                    IssueFormsAuthenticationTicket(user, rememberMe);

                    // We're done, let's get back to where we started from.
                    if (string.IsNullOrEmpty(returnUrl))
                        return RedirectToAction("Index", "Home");
                    else
                        return Redirect(returnUrl);
                }

                var registrationModel = new RegistrationViewModel(identifier)
                {
                    Username = user.Username,
                    Email = user.Email,
                    FullName = user.FullName,
                    ReturnUrl = returnUrl
                };

                return View(registrationModel);
            }
            catch
            {
                var registrationModel = new RegistrationViewModel(identifier)
                {
                    Username = user.Username,
                    Email = user.Email,
                    FullName = user.FullName,
                    ReturnUrl = returnUrl
                };

                return View(registrationModel);
            }
        }
示例#6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the OpenIds EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToOpenIds(OpenId openId)
 {
     base.AddObject("OpenIds", openId);
 }