public CustomerContactService(ICustomerRepository customerRepository, ICustomerContactRepository customerContactRepository,
                               IResourceService <SharedResource> sharedResourceService, IResourceService <GhmCustomerResource> customerResourceService)
 {
     _customerRepository        = customerRepository;
     _customerContactRepository = customerContactRepository;
     _sharedResourceService     = sharedResourceService;
     _CustomerResourceService   = customerResourceService;
 }
Exemple #2
0
 public HomeController()
 {
     _carsRepo                  = CarRepositoryFactory.GetRepository();
     _specialsRepo              = SpecialsRepositoryFactory.GetRepository();
     _makeRepo                  = MakeRepositoryFactory.GetRepository();
     _modelRepo                 = ModelRepositoryFactory.GetRepository();
     _colorRepo                 = ColorRepositoryFactory.GetRepository();
     _bodyStyleRepository       = BodyStyleRepositoryFactory.GetRepository();
     _transmissionRepository    = TransmissionRepositoryFactory.GetRepository();
     _customerContactRepository = CustomerContactRepositoryFactory.GetRepository();
 }
 public CustomerService(ICustomerRepository customerRepository, IContactCustomerRepository contactCustomerRepository,
                        ICustomerContactRepository customerContactRepository, IResourceService <SharedResource> sharedResourceService,
                        IResourceService <GhmCustomerResource> customerResourceService, IConfiguration configuration)
 {
     _customerRepository        = customerRepository;
     _contactCustomerRepository = contactCustomerRepository;
     _customerContactRepository = customerContactRepository;
     _sharedResourceService     = sharedResourceService;
     _customerResourceService   = customerResourceService;
     _configuration             = configuration;
 }
Exemple #4
0
        public CustomerContactType(ICustomerContactRepository repository)
        {
            Name = "CustomerContact";

            Field(i => i.Id).Description("The identity of the customer");
            Field(i => i.PersonalNumber).Description("The personal number of the customer");
            Field(i => i.Email).Description("The email address of the customer");
            Field(i => i.Street).Description("The street address of the customer");
            Field(i => i.ZipCode).Description("The zip code of the customer");
            Field(i => i.Country).Description("The country of the customer");
            Field(i => i.PhoneNumber).Description("The phone number of the customer");
        }
Exemple #5
0
 public AdminController()
 {
     _carsRepo                  = CarRepositoryFactory.GetRepository();
     _specialsRepo              = SpecialsRepositoryFactory.GetRepository();
     _makeRepo                  = MakeRepositoryFactory.GetRepository();
     _modelRepo                 = ModelRepositoryFactory.GetRepository();
     _colorRepo                 = ColorRepositoryFactory.GetRepository();
     _bodyStyleRepository       = BodyStyleRepositoryFactory.GetRepository();
     _transmissionRepository    = TransmissionRepositoryFactory.GetRepository();
     _customerContactRepository = CustomerContactRepositoryFactory.GetRepository();
     _purchaseLogRepository     = PurchaseLogRepositoryFactory.GetRepository();
     _userRepository            = UserRepositoryFactory.GetRepository();
 }
Exemple #6
0
        public CustomerContactQuery(ICustomerContactRepository repository)
        {
            Name = "Query";

            Field <CustomerContactType>(
                "customerContact",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "id", Description = "identity of the customer"
            }
                    ),
                resolve: context => repository.GetById(context.GetArgument <Guid>("id"))
                );

            Field <ListGraphType <CustomerContactType> >(
                "customerContacts",
                resolve: context => repository.GetAll()
                );
        }
Exemple #7
0
        public CustomerContactMutation(ICustomerContactRepository repository)
        {
            Name = "Mutation";

            Field <CustomerContactType>(
                "createCustomerContact",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <NewCustomerContactInputType> > {
                Name = "customerContact"
            }
                    ),
                resolve: context =>
            {
                try
                {
                    var entity = context.GetArgument <Domain.Entity.CustomerContact>("customerContact");

                    // Validate business rules
                    entity.ValidateAndThrow();

                    return(repository.Add(entity).GetAwaiter().GetResult());
                }
                catch (Exception e)
                {
                    context.Errors.Add(new ExecutionError($"Creating customer contact failed: {e.Message}"));
                    return(null);
                }
            });

            Field <CustomerContactType>(
                "updateCustomerContact",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <NewCustomerContactInputType> > {
                Name = "customerContact"
            },
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "id", Description = "identity of the customer"
            }
                    ),
                resolve: context =>
            {
                try
                {
                    var entity = context.GetArgument <Domain.Entity.CustomerContact>("customerContact");

                    // Validate business rules
                    entity.ValidateAndThrow();

                    return(repository.Update(
                               entity,
                               context.GetArgument <Guid>("id"))
                           .GetAwaiter()
                           .GetResult());
                }
                catch (Exception e)
                {
                    context.Errors.Add(new ExecutionError($"Updating customer contact failed: {e.Message}"));
                    return(null);
                }
            });

            Field <StringGraphType>(
                "deleteCustomerContact",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <IdGraphType> > {
                Name = "id", Description = "identity of the customer"
            }
                    ),
                resolve: context =>
            {
                var id = context.GetArgument <Guid>("id");
                try
                {
                    var customerContact = repository.GetById(id).GetAwaiter().GetResult();
                    if (customerContact == null)
                    {
                        context.Errors.Add(new ExecutionError("Unable to find customer contact in db."));
                        return(null);
                    }

                    repository.Delete(id).GetAwaiter().GetResult();
                    return($"Customer contact with id {id} has been deleted.");
                }
                catch (Exception e)
                {
                    context.Errors.Add(new ExecutionError($"Deleting customer contact failed: {e.Message}"));
                    return(null);
                }
            });
        }
 public CustomerContactService(ICustomerContactRepository customerContactRepository)
 {
     this.customerContactRepository = customerContactRepository;
 }
 public CustomerContactHelper(ICustomerContactRepository customerContactRepository)
 {
     _customerContactRepository = customerContactRepository;
 }
Exemple #10
0
 public CustomerContactApp(ICustomerContactRepository repository)
 {
     this.repository = repository;
 }