Example #1
0
        public static string Login(string mobilePhone, string password, JewelleryDBEntities db)
        {
            var account = db.Account.Single(q => q.MobilePhone == mobilePhone && q.Password == password);

            var tokenString = TokenBL.Create(account.Id, db);

            return(tokenString);
        }
Example #2
0
        public static AccountDTO GetByTokenString(string tokenString, JewelleryDBEntities db)
        {
            var token = TokenBL.TryGet(tokenString, db);

            if (token != null)
            {
                var account = db.Account.Single(q => q.Id == token.AccountId);
                return(AccountMapper.MapToDTO(account));
            }

            return(null);
        }