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

            var result = await Service.UpdateAsync(user);

            return(result);
        }
Пример #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));
        }
Пример #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));
        }
Пример #5
0
 public AuthorisedUser(SpecialAppUsers user)
 {
     this.user = user;
 }
Пример #6
0
 public async Task <IdentityResult> UpdateAsync(SpecialAppUsers users)
 {
     return(await UserManager.UpdateAsync(users));
 }
Пример #7
0
        public ITokenService GenerateToken(IConfigurationRoot config, SpecialAppUsers user, bool rememberMe = false)
        {
            CreateToken(config, user, rememberMe);

            return(this);
        }
Пример #8
0
 public UnautorisedUser(SpecialAppUsers users)
 {
     this.users = users;
 }