コード例 #1
0
        public async Task <UserSignInModel> GetSignInInfoAsync(LogInInfo logInCommand)
        {
            var user = await ReadRepository.GetSingleAsync(_userFiltersProvider.ActiveByEmail(logInCommand.Email), _userRelationsProvider.JoinRole);

            return(user != null && user.PasswordHash.Equals(logInCommand.PasswordHash, StringComparison.OrdinalIgnoreCase)
                ? Mapper.Map <UserSignInModel>(user)
                : null);
        }
コード例 #2
0
        public async Task <BrandModel> GetByIdAsync(int id)
        {
            var brand = await ReadRepository.GetSingleAsync(_filtersProvider.ById(id), _relationsProvider.JoinCountry);

            if (brand == null)
            {
                throw new NotFoundException("Item was not found!");
            }

            return(Mapper.Map <BrandModel>(brand));
        }
コード例 #3
0
        public async Task <DeliveryRequestModel> GetByIdAsync(int id)
        {
            var item = await ReadRepository.GetSingleAsync(_filtersProvider.ById(id), _relationsProvider.JoinDeliveryRequestInfo);

            if (item == null)
            {
                throw new NotFoundException("Item was not found!");
            }

            return(Mapper.Map <DeliveryRequestModel>(item));
        }
コード例 #4
0
        public async Task <UserModel> GetActiveByIdAsync(int id)
        {
            var user = await ReadRepository.GetSingleAsync(_filtersProvider.ActiveById(id), _relationsProvider.JoinRole);

            if (user == null)
            {
                throw new NotFoundException("Item was not found!");
            }

            return(Mapper.Map <UserModel>(user));
        }
コード例 #5
0
        public async Task <SupplierModel> GetByBrandIdAsync(int id)
        {
            var supplier = await ReadRepository.GetSingleAsync(_filtersProvider.ByBrandId(id), _relationsProvider.JoinBrandAndCountry);

            if (supplier == null)
            {
                throw new NotFoundException("Item was not found!");
            }

            return(Mapper.Map <SupplierModel>(supplier));
        }
コード例 #6
0
        public virtual async Task <TResponse> GetByIdAsync(int id)
        {
            var item = await ReadRepository.GetSingleAsync(_filtersProvider.ById(id));

            if (item == null)
            {
                throw new NotFoundException("Item was not found!");
            }

            return(Mapper.Map <TResponse>(item));
        }
コード例 #7
0
        public async Task <CarEngineModel> GetByIdAsync(int id)
        {
            var item = await ReadRepository.GetSingleAsync(_engineFiltersProvider.ById(id), _engineRelationsProvider.JoinEngineType);

            if (item == null)
            {
                throw new NotFoundException("Item was not found!");
            }

            return(Mapper.Map <CarEngineModel>(item));
        }
コード例 #8
0
        public async Task <ClientModel> GetByPassportIdAsync(string passportId)
        {
            var item = await ReadRepository.GetSingleAsync(_clientFiltersProvider.ByPassportId(passportId));

            if (item == null)
            {
                throw new NotFoundException("Item was not found!");
            }

            return(Mapper.Map <ClientModel>(item));
        }
コード例 #9
0
        public async Task <FileModel> GetPhotoByIdAsync(int id)
        {
            var item = await ReadRepository.GetSingleAsync(_photoFiltersProvider.ById(id));

            if (item == null)
            {
                throw new NotFoundException("File was not found!");
            }

            var content = await _fileManager.LoadAsync(item.FileName, FileDestinations.SupplierPhoto);

            return(item.ToFileModel(content));
        }