本文整理汇总了C#中ICustomerRepository类的典型用法代码示例。如果您正苦于以下问题:C# ICustomerRepository类的具体用法?C# ICustomerRepository怎么用?C# ICustomerRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICustomerRepository类属于命名空间,在下文中一共展示了ICustomerRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
public void Init()
{
Mock<ICustomerRepository<CustomerModel>> mockCustomerRepository = new Mock<ICustomerRepository<CustomerModel>>();
Mock<IEngineerRepository<EngineerModel>> mockEngineerRepository = new Mock<IEngineerRepository<EngineerModel>>();
Mock<IInstallationRepository<InstallationModel>> mockInstallationRepository = new Mock<IInstallationRepository<InstallationModel>>();
List<EngineerModel> engineers = new List<EngineerModel>
{
new EngineerModel {engineerid=0, firstname="Karl", lastname="Maier", password="test123",email="[email protected]", username="karli"}
};
List<InstallationModel> installations = new List<InstallationModel>
{
new InstallationModel { installationid= 0, customerid=0, description="test", latitude=44, longitude=55, Measurement= new List<int>{0}, serialno="serial"}
};
List<CustomerModel> customers = new List<CustomerModel>
{
new CustomerModel { customerid=0, engineerid=0, firstname="Anton", lastname="Huber", password="test",email="[email protected]", username="toni", Installation=new List<int> {0}}
};
mockCustomerRepository.Setup(mr => mr.GetAll()).Returns(customers);
mockCustomerRepository.Setup(mr => mr.GetById(It.IsAny<int>())).Returns((int customerid) => customers.Where(customer => customer.customerid == customerid).Single());
mockCustomerRepository.Setup(mr => mr.Add(It.IsAny<CustomerModel>())).Callback((CustomerModel customer) => customers.Add(customer));
mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny<int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList<InstallationModel>());
mockInstallationRepository.Setup(mr => mr.Add(It.IsAny<InstallationModel>())).Callback((InstallationModel installation) => installations.Add(installation));
mockInstallationRepository.Setup(mr => mr.GetAll()).Returns(installations);
mockEngineerRepository.Setup(mr => mr.GetMyCustomers(It.IsAny<int>())).Returns((int id) => customers.Where(customer => customer.engineerid == id).ToList<CustomerModel>());
this.mockcrepo = mockCustomerRepository.Object;
this.mockirepo = mockInstallationRepository.Object;
this.mockerepo = mockEngineerRepository.Object;
}
示例2: CartController
public CartController(ICustomerRepository customerRepository,
IProductRepository productRepository)
: base(customerRepository)
{
_productRepository = productRepository;
_customerRepository = customerRepository;
}
示例3: VehicleEditorModel
public VehicleEditorModel(ICustomerRepository customerRepository, IVehicleGroupRepository vehicleGroupRepository,
IVehicleRepository vehicleRepository,
IVehicleDetailRepository vehicleDetailRepository, IVehicleWheelRepository vehicleWheelRepository,
ISparepartRepository sparepartRepository, ITypeRepository typeRepository,
ISpecialSparepartDetailRepository wheelDetailRepository, IBrandRepository brandRepository,
ISparepartDetailRepository sparepartDetailRepository,
ISpecialSparepartDetailRepository specialSparepartDetailRepository,
ISparepartStockCardRepository sparepartStokCardRepository,
IReferenceRepository referenceRepository,
IUnitOfWork unitOfWork)
: base()
{
_customerRepository = customerRepository;
_vehicleGroupRepository = vehicleGroupRepository;
_vehicleRepository = vehicleRepository;
_vehicleDetailRepository = vehicleDetailRepository;
_vehicleWheelRepository = vehicleWheelRepository;
_specialSparepartDetailRepository = wheelDetailRepository;
_sparepartDetailRepository = sparepartDetailRepository;
_sparepartRepository = sparepartRepository;
_typeRepository = typeRepository;
_brandRepository = brandRepository;
_sparepartStokCardRepository = sparepartStokCardRepository;
_referenceRepository = referenceRepository;
_unitOfWork = unitOfWork;
}
示例4: RentalAgreementService
public RentalAgreementService(IRentalAgreementRepository theRentalAgreementRepository,
ICustomerRepository theCustomerRepository, IUserRepository theUserRepository)
{
_rentalAgreementRepository = theRentalAgreementRepository;
_customerRepository = theCustomerRepository;
_userRepository = theUserRepository;
}
示例5: CostAnalyzerController
/// <summary>
///
/// </summary>
/// <param name="custRepo"></param>
/// <param name="modifiedCustRepository"></param>
/// <param name="vesselRepo"></param>
public CostAnalyzerController(IRepository<customer> custRepo, ICustomerRepository modifiedCustRepository, IRepository<vessel> vesselRepo, ICostAnalyzerService costAnalyzerService)
{
this.customerRepository = custRepo;
this.modifiedCustRepository = modifiedCustRepository;
this.vesselRepository = vesselRepo;
this.costAnalyzerService = costAnalyzerService;
}
示例6: GetCustomerRepo
public static ICustomerRepository GetCustomerRepo()
{
if (customerRepo == null)
customerRepo = new CustomerRepository();
return customerRepo;
}
示例7: IntegrationModule
public IntegrationModule(ICustomerRepository customers, IClientRepository clients)
{
Get["/Integration/ClientCustomerContracts/All"] = param =>
{
var result = new List<IntegrationClientDto>();
var clientContracts = clients.ToList().Select(
s =>
new IntegrationClientDto(s.Id, s.Name, s.ClientAccountNumber.ToString(), s.IsActive,
s.Contracts
.Select(c => new IntegrationContractDto(c.Id, c.Name, c.Packages
.Select(p => new PackageDto() {PackageId = p.PackageId, Name = p.Name, IsActive = p.IsActive}))))).ToList();
result.AddRange(clientContracts.Where(w => w.Contracts.Any()));
var customerContracts = customers.ToList().Select(
s =>
new IntegrationClientDto(s.Id, s.Name, s.CustomerAccountNumber.ToString(), s.IsActive,
s.Contracts.Select(c => new IntegrationContractDto(c.Id, c.Name, c.Packages
.Select(p => new PackageDto() { Id = p.Id, PackageId = p.PackageId, Name = p.Name, IsActive = p.IsActive}))))).ToList();
result.AddRange(customerContracts.Where(w => w.Contracts.Any()));
return Response.AsJson(result);
};
}
示例8: BeforeEach
public void BeforeEach()
{
_productRepo = Substitute.For<IProductRepository>();
_orderFulfillmentService = Substitute.For<IOrderFulfillmentService>();
_customerRepository = Substitute.For<ICustomerRepository>();
_taxRateService = Substitute.For<ITaxRateService>();
_emailService = Substitute.For<IEmailService>();
_subject = new OrderService(_orderFulfillmentService,
_customerRepository,
_taxRateService,
_emailService);
_bestCustomer = new Customer
{
CustomerId = 42,
PostalCode = "12345",
Country = "Merica"
};
_listOfTaxEntries = new List<TaxEntry>
{
new TaxEntry {Description = "High Tax", Rate = (decimal) 0.60},
new TaxEntry {Description = "Low Tax", Rate = (decimal) 0.10}
};
_orderConfirmation = new OrderConfirmation
{
OrderId = 1234,
OrderNumber = "hello"
};
_customerRepository.Get(_bestCustomer.CustomerId.Value).Returns(_bestCustomer);
_taxRateService.GetTaxEntries(_bestCustomer.PostalCode, _bestCustomer.Country).Returns(_listOfTaxEntries);
}
示例9: CustomerService
public CustomerService(ICustomerRepository customerRepository, IUnitOfWork unitOfWork)
{
if (customerRepository == null) throw new ArgumentNullException("Customer repo");
if (unitOfWork == null) throw new ArgumentNullException("Unit of work");
_customerRepository = customerRepository;
_unitOfWork = unitOfWork;
}
示例10: CustomerService
public CustomerService(
ICustomerRepository customerRepository,
ICustomerFullNameBuilder customerFullName)
{
_customerRepository = customerRepository;
_customerFullName = customerFullName;
}
示例11: UserService
public UserService(IUserAccountRepository userAccountRepository, ICustomerRepository customerRepository, IUserRoleRepository userRoleRepository, IRoleRepository roleRepository)
{
_customerRepository = customerRepository;
_userRoleRepository = userRoleRepository;
_roleRepository = roleRepository;
_userAccountRepository = userAccountRepository;
}
示例12: CustomerService_9
public CustomerService_9(ICustomerRepository customerRepository, IMailingRepository mailingRepository)
{
_customerRepository = customerRepository;
_mailingRepository = mailingRepository;
_customerRepository.NotifySalesTeam += _customerRepository_NotifySalesTeam;
}
示例13: CustomerService
public CustomerService(
ICustomerRepository customerRepository,
IIdFactory idFactory)
{
_customerRepository = customerRepository;
_idFactory = idFactory;
}
示例14: OrderController
public OrderController(ICustomerRepository customerRepository,
IOrderRepository orderRepository)
: base(customerRepository)
{
_orderRepository = orderRepository;
_customerRepository = customerRepository;
}
示例15: CustomerFacade
public CustomerFacade(ICustomerRepository customerRepository, IAddressRepository addressRepository, IAuth auth, IPasswordHandler passwordHandler)
{
_customerRepository = customerRepository;
_addressRepository = addressRepository;
_auth = auth;
_passwordHandler = passwordHandler;
}