コード例 #1
0
        public async Task <IEnumerable <Customer> > GetCustomers()
        {
            var customers = await CustomerDatabase.GetCustomers();

            return(customers.Select(c => new Customer {
                Id = c.Id, Name = c.Name
            }));
        }
コード例 #2
0
        public async Task Handle(SaveCustomer message, IMessageHandlerContext context)
        {
            var newCustomer = new CustomerEntity {
                Id = message.Id, Name = message.Name + "ByServer"
            };

            Logger.Info($"Attempting to create customer with name '{newCustomer.Name}'");

            await CustomerDatabase.Save(newCustomer);

            await customerHubContext.Clients.All.CustomerAdded(newCustomer);

            Logger.Info($"Created customer with name '{newCustomer.Name}'");
        }