Esempio n. 1
0
        public virtual async Task <T> GetAsync(long id)
        {
            var result = await BaseQuery.FirstOrDefaultAsync(x => x.Id == id);

            if (result == null)
            {
                throw new NotFoundException(typeof(Food), id);
            }
            return(result);
        }
Esempio n. 2
0
        public async Task <string> GetUserTokenAsync(int userId, CancellationToken cancellationToken = default)
        {
            var result = await BaseQuery.FirstOrDefaultAsync(x => x.UserId == userId, cancellationToken);

            return(result != null ? result.Token : "");
        }