/// <inheritdoc/> public async Task <bool> CreateSolidStateDriveAsync(SolidStateDriveInsertDto solidStateDrive) { var mappedSSD = _mapper.Map <SolidStateDriveInsertDto, SolidStateDriveEntity>(solidStateDrive); var entityAlreadyExists = await _unitOfWorkHardwareAPI.SolidStateDrivesRepository.AnyAsync(x => x.Equals(mappedSSD)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.SolidStateDrivesRepository.AddAsync(mappedSSD); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }
/// <inheritdoc/> public async Task <bool> CreateHardDriveDiskAsync(HardDriveDiskInsertDto hardDriveDisk) { var mappedHDD = _mapper.Map <HardDriveDiskInsertDto, HardDriveDiskEntity>(hardDriveDisk); var entityAlreadyExists = await _unitOfWorkHardwareAPI.HardDrivesRepository.AnyAsync(x => x.Equals(mappedHDD)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.HardDrivesRepository.AddAsync(mappedHDD); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }
/// <inheritdoc/> public async Task <bool> CreateCaseAsync(CaseInsertDto @case) { var mappedCase = _mapper.Map <CaseInsertDto, CaseEntity>(@case); var entityAlreadyExists = await _unitOfWorkHardwareAPI.CasesRepository.AnyAsync(x => x.Equals(mappedCase)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.CasesRepository.AddAsync(mappedCase); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }
/// <inheritdoc/> public async Task <bool> CreateRandomAccessMemoryAsync(RandomAccessMemoryInsertDto randomAccessMemory) { var mappedRAM = _mapper.Map <RandomAccessMemoryInsertDto, RandomAccessMemoryEntity>(randomAccessMemory); var entityAlreadyExists = await _unitOfWorkHardwareAPI.RandomAccessMemoryRepository.AnyAsync(x => x.Equals(mappedRAM)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.RandomAccessMemoryRepository.AddAsync(mappedRAM); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }
/// <inheritdoc/> public async Task <bool> CreateProcessorAsync(ProcessorInsertDto processor) { var mappedCpu = _mapper.Map <ProcessorInsertDto, ProcessorEntity>(processor); var entityAlreadyExists = await _unitOfWorkHardwareAPI.ProcessorsRepository.AnyAsync(x => x.Equals(mappedCpu)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.ProcessorsRepository.AddAsync(mappedCpu); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }
/// <inheritdoc/> public async Task <bool> CreateVideoCardAsync(VideoCardInsertDto videoCard) { var mappedGPU = _mapper.Map <VideoCardInsertDto, VideoCardEntity>(videoCard); var entityAlreadyExists = await _unitOfWorkHardwareAPI.VideoCardsRepository.AnyAsync(x => x.Equals(mappedGPU)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.VideoCardsRepository.AddAsync(mappedGPU); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }
/// <inheritdoc/> public async Task <bool> CreateMotherboardAsync(MotherboardInsertDto motherboard) { var mappedMotherboard = _mapper.Map <MotherboardInsertDto, MotherboardEntity>(motherboard); var entityAlreadyExists = await _unitOfWorkHardwareAPI.MotherboardsRepository.AnyAsync(x => x.Equals(mappedMotherboard)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.MotherboardsRepository.AddAsync(mappedMotherboard); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }
/// <inheritdoc/> public async Task <bool> CreatePowerSupplyAsync(PowerSupplyInsertDto powerSupply) { var mappedPowerSupply = _mapper.Map <PowerSupplyInsertDto, PowerSupplyEntity>(powerSupply); var entityAlreadyExists = await _unitOfWorkHardwareAPI.PowerSuppliersRepository.AnyAsync(x => x.Equals(mappedPowerSupply)); if (entityAlreadyExists) { return(false); } await _unitOfWorkHardwareAPI.PowerSuppliersRepository.AddAsync(mappedPowerSupply); return(await _unitOfWorkHardwareAPI.SaveChangesAsync() > 0); }