Esempio n. 1
0
 public async Task Handle(AddOrderLine message, IMessageHandlerContext context)
 {
     using (var session = orm.OpenSession())
     {
         var order = session.Get(message.OrderId);
         order.AddLine(message.Product, message.Quantity);
         session.Commit();
     }
 }
Esempio n. 2
0
 public void Handle(AddOrderLine message)
 {
     using (var session = orm.OpenSession())
     {
         var order = session.Get(message.OrderId);
         order.AddLine(message.Product, message.Quantity);
         session.Commit();
     }
 }
Esempio n. 3
0
 public Task Handle(AddOrderLine message, IMessageHandlerContext context)
 {
     using (var session = orm.OpenSession())
     {
         var order = session.Get(message.OrderId);
         if (!order.HasLine(message.LineId))
         {
             order.AddLine(message.Product, message.Quantity);
             session.Commit();
         }
     }
     return(Task.CompletedTask);
 }