public async Task <bool> StoreActivationCode(Confirmationcode _confirmationCode)
        {
            await _context.Confirmationcode.AddAsync(_confirmationCode);

            await _context.SaveChangesAsync();

            return(true);
        }
        public async Task <UserLog> Register(UserLog User, string Password)
        {
            // here we have to hash password

            await _context.UserLog.AddAsync(User);

            await _context.SaveChangesAsync();

            return(User);
        }
        public async Task <bool> AddFan(int userId, int fanID)
        {
            Fan temp_fan = new Fan();

            temp_fan.TimeAdded = DateTime.UtcNow;
            temp_fan.UserId    = userId;
            temp_fan.IdFan     = fanID;

            await _context.Fan.AddAsync(temp_fan);

            await _context.SaveChangesAsync();

            return(true);
        }
Example #4
0
        public async Task <UserLog> Register(UserLog User, string Password)
        {
            // here we have to hash password
            byte[] PasswordHash, PasswordSalt;
            CreatePasswordHash(Password, out PasswordHash, out PasswordSalt);

            User.Activated = "F";
            User.Disabled  = "F";
            User.UserReg   = DateTime.UtcNow;
            //User.password_hash = PasswordHash;
            //User.password_salt = PasswordSalt;
            User.UserSex = User.UserSex.ToLower();
            if (User.UserSex == "male")
            {
                User.UserSex = "M";
            }
            else if (User.UserSex == "female")
            {
                User.UserSex = "F";
            }
            else
            {
                User.UserSex = "M";
            }

            // we have to hash and salt the password using method
            //User.UserPassword = Password;
            //
            User.PasswordHash = PasswordHash;
            User.PasswordSalt = PasswordSalt;
            // Console.WriteLine(User.PasswordHash);
            // Console.WriteLine(User.PasswordSalt);
            await _context.UserLog.AddAsync(User);

            await _context.SaveChangesAsync();

            return(User);
        }
        public async Task <bool> SaveAll()
        {
            await _context.SaveChangesAsync();

            return(true);
        }