public void Execute(RemoveMainOrderLineItemCommand command)
 {
     _log.InfoFormat("Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
     try
     {
         if (!DocumentExists(command.DocumentId))
         {
             _log.InfoFormat("Cannot Edit line item. Document does not exist  Execute {1} - Command Id {0} ", command.CommandId, command.GetType());
             return;
         }
         if (DocumentLineItemExists(command.LineItemId))
         {
             tblDocument doc = ExistingDocument(command.DocumentId);
             tblLineItems lineItem = doc.tblLineItems.First(s => s.id == command.LineItemId);
             lineItem.LineItemStatusId = (int)MainOrderLineItemStatus.Removed; ;
             _cokeDataContext.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString());
         _log.Error("RemoveMainOrderLineItemCommandHandler exception", ex);
         throw;
     }
 }
Пример #2
0
 public void Handle(RemoveMainOrderLineItemCommand command)
 {
     var order = GetOrder();
     order.LineItems.RemoveAll(l => l.Id == command.LineItemId);
 }