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); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }