예제 #1
0
        //Tested
        public async Task <int> LogInAsync(string nickname, string password)
        {
            UserEntity Entity = await UserCrud.SelectOneAsync(new UserEntity()
            {
                Nickname = nickname, Password = Md5.GetHashString(password)
            })
                                ?? await UserCrud.SelectOneAsync(new UserEntity()
            {
                Nickname = nickname, Password = password
            });

            if (Entity != null)
            {
                User = await Convert.ToUserModelAsync(Entity);

                UserLogged = true;
                return(1);
            }
            else
            {
                User = new UserModel()
                {
                    SubscribersNicknames   = new List <string>(),
                    FavoriteUsersNicknames = new List <string>()
                };
                UserLogged = false;
                return(0);
            }
        }