Exemplo n.º 1
0
 public IEnumerable <GAPWebAPIUserToken> GetbyGuid(Guid userGuid)
 {
     using (var context = new GapContext())
     {
         return(context.GAPWebAPIUserToken
                .AsNoTracking().Where(x => x.WebAPIUser_Guid == userGuid).ToList());
     }
 }
Exemplo n.º 2
0
 public bool ExpiredTokenKey(Guid?tokenId)
 {
     using (var context = new GapContext())
     {
         var token = context.GAPWebAPIUserToken.AsNoTracking().Where(x => x.TokenId == tokenId).FirstOrDefault();
         return(token.TokenExpireDateTime < DateTime.Now);
     }
 }
 public GAPWebApiUser GetByNamePassword(string UserName, string Password)
 {
     using (var context = new GapContext())
     {
         return(context.GAPWebAPIUsers
                .AsNoTracking()
                .FirstOrDefault(x => x.UserName == UserName && x.Password == Password));
     }
 }
 public async Task <IEnumerable <GAPWebApiUser> > GetAll()
 {
     using (var context = new GapContext())
     {
         return(await context.GAPWebAPIUsers
                .AsNoTracking()
                .ToListAsync());
     }
 }
 public async Task <IEnumerable <GAPWebApiUser> > Query(Expression <Func <GAPWebApiUser, bool> > predicate)
 {
     using (var context = new GapContext())
     {
         return(await context.GAPWebAPIUsers
                .AsNoTracking()
                .Where(predicate)
                .ToListAsync());
     }
 }
Exemplo n.º 6
0
        public Guid InsertOrUpdate(Guid userGuid)
        {
            var userToken = CreateTokenKey(userGuid);

            using (var context = new GapContext())
            {
                context.Entry(userToken).State = userToken.EntityState.ToEntityFrameworkState();
                context.SaveChanges();
                return(userToken.TokenId);
            }
        }
Exemplo n.º 7
0
        public bool Delete(Guid webUserTokenGuid)
        {
            using (var context = new GapContext())
            {
                bool flagReturn = false;
                var  userToken  = context.GAPWebAPIUserToken.Where(y => y.TokenId == webUserTokenGuid).FirstOrDefault();
                if (userToken == null)
                {
                    return(flagReturn);
                }

                context.GAPWebAPIUserToken.Remove(userToken);
                context.SaveChanges();
                flagReturn = true;
                return(flagReturn);
            }
        }