Example #1
0
        public async Task <AddCustomerPayload> AddCustomerAsync(AddCustomerInput input, [ScopedService] ApplicationDbContext context, [Service] ITopicEventSender eventSender)
        {
            var customer = new Customers
            {
                Id       = input.Id,
                LastName = input.Surname
            };

            context.Customers.Add(customer);
            await context.SaveChangesAsync();

            await eventSender.SendAsync(nameof(CustomerSubscriptions.OnCustomerCreationAsync), customer.Id);

            return(new AddCustomerPayload(customer));
        }
Example #2
0
        public async Task AddCustomer(AddCustomerInput input)
        {
            var customer = _customerFactory.Create(input.Name, input.Mobile, input.Labels.ToList());

            await _customerRepository.InsertAsync(customer);
        }
        public async Task <IActionResult> Add(AddCustomerInput input)
        {
            await _customerAppService.AddCustomer(input);

            return(Ok());
        }