Example #1
0
        public async Task <string> Login(string email, string password)
        {
            Guid customerId = new Guid();

            foreach (var item in _context.Customers)
            {
                if (item.Email == email && Hashing.AreEqual(password, item.Password, item.Salt))
                {
                    customerId = item.CustomerId;
                    break;
                }
            }
            var currentAccount = await _context.Accounts.FirstOrDefaultAsync(c => c.CustomerId == customerId);

            if (currentAccount == null)
            {
                return(null);
            }
            return(currentAccount.AccountId.ToString());
        }