Example #1
0
 public AppUser(SpecialAppUsers user)
 {
     this.user         = user;
     UnauthorisedUser  = new UnautorisedUser(user);
     AuthorisedUser    = new AuthorisedUser(user);
     this.currentState = new UnautorisedUser(user);
 }
Example #2
0
        public async Task <IdentityResult> UpdateAsync(SpecialAppUsers user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            var result = await Service.UpdateAsync(user);

            return(result);
        }
Example #3
0
        public async Task <IdentityResult> CreateAsync(SpecialAppUsers users, string password)
        {
            var result = await UserManager.FindByEmailAsync(users.Email);

            if (result != null)
            {
                var busex = busExFunc();
                busex.Add("EmailAddress", "Email address already exists");
                busex.ThrowIfErrors();
            }
            return(await UserManager.CreateAsync(users, password));
        }
Example #4
0
        public async Task <Tuple <SpecialAppUsers, SpecialAppUsers> > CreateTestAsync()
        {
            var result = await Service.FindByEmailAsync("*****@*****.**");

            var result2 = await Service.FindByEmailAsync("*****@*****.**");

            var user = new SpecialAppUsers
            {
                Email       = "*****@*****.**",
                UserName    = "******",
                PhoneNumber = "0433277470"
            };

            var user2 = new SpecialAppUsers
            {
                Email       = "*****@*****.**",
                UserName    = "******",
                PhoneNumber = "0430499210"
            };

            if (result == null)
            {
                await Service.CreateAsync(user, "Cloudn@9");
            }
            else
            {
                result.PhoneNumber = user.PhoneNumber;
                await Service.UpdateAsync(result);
            }

            if (result2 == null)
            {
                await Service.CreateAsync(user2, "Cloudn@9");
            }
            else
            {
                result2.PhoneNumber = user2.PhoneNumber;
                await Service.UpdateAsync(result2);
            }

            result = await Service.FindByEmailAsync("*****@*****.**");

            result2 = await Service.FindByEmailAsync("*****@*****.**");

            return(new Tuple <SpecialAppUsers, SpecialAppUsers>(result, result2));
        }
Example #5
0
 public AuthorisedUser(SpecialAppUsers user)
 {
     this.user = user;
 }
Example #6
0
 public async Task <IdentityResult> UpdateAsync(SpecialAppUsers users)
 {
     return(await UserManager.UpdateAsync(users));
 }
Example #7
0
        public ITokenService GenerateToken(IConfigurationRoot config, SpecialAppUsers user, bool rememberMe = false)
        {
            CreateToken(config, user, rememberMe);

            return(this);
        }
Example #8
0
 public UnautorisedUser(SpecialAppUsers users)
 {
     this.users = users;
 }