/// <summary>
        /// Since our Login page is an Angular template we are in an AJAX/REST call
        /// Instead of ActionResult (Redirect/View) we will return WebApiSimpleResult and process on client side
        /// </summary>
        public void Post(RegisterData model)
        {
            // but we don't need transaction scope here, since we have an atomic operation only (CreateAsync)
            using (var scope = Scope("Post"))
            {
                // prepare
                Helper.Expect(model);

                // validate
                Helper.ValidateModel(model, true);

                // process
                var user = new BusinessEntities.Users.User(
                    null,
                    model.FirstName,
                    model.LastName,
                    model.Email,
                    model.Email,
                    model.Password,
                    BikeRentals.Security.Principals.RoleType.User,
                    false
                    );

                UserManager.Add(user);

                //await SignInManager.Value.SignInAsync(user, isPersistent: false, rememberBrowser: false); - do not login
                scope.Complete(() => $"User created with Id={user.UserId}.");
            }
        }
Beispiel #2
0
 public UserRef(BusinessEntities.Users.User user)
 {
     if (user != null)
     {
         this.FirstName = user.FirstName;
         this.LastName  = user.LastName;
         this.UserId    = user.UserId;
     }
 }
Beispiel #3
0
 public User(BusinessEntities.Users.User entity)
 {
     this.UserId    = entity.UserId;
     this.FirstName = entity.FirstName;
     this.LastName  = entity.LastName;
     this.Email     = entity.Email;
     this.Group     = entity.Group;
     this.TenantId  = entity.TenantId;
     this.FullName  = entity.FullName;
 }
Beispiel #4
0
 public User(BusinessEntities.Users.User user)
     : base(user)
 {
     if (user != null)
     {
         this.UserName = user.UserName;
         this.Email    = user.Email;
         this.Role     = user.Role;
     }
 }
Beispiel #5
0
 public UserSelectItem(BusinessEntities.Users.User entity)
 {
     UserId       = entity.UserId;
     UserFullName = entity.FullName;
 }