Пример #1
0
        public async Task <Result <long> > CountAsync(Expression <Func <TEntity, bool> > filter)
        {
            if (filter == null)
            {
                return(new Result <long>(0, HttpStatusCode.BadRequest, problemTittle: "Filter cannot be null"));
            }

            long count;

            try
            {
                count = await _repositoryBase.CountAsync(filter);
            }
            catch (Exception)
            {
                return(new Result <long>(0, HttpStatusCode.InternalServerError, problemTittle: $"Error on count objects {typeof(TEntity).Name}."));
            }

            return(new Result <long>(count, HttpStatusCode.OK));
        }
Пример #2
0
        async Task <bool> EmailExistsAsync(string email)
        {
            var foundCount = await _userRepository.CountAsync(a => a.Email == email);

            return(foundCount > 0);
        }