public void Execute(RejectMainOrderCommand command) { _log.InfoFormat("Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString()); try { if (!DocumentExists(command.DocumentId)) return; RejectDocument(command.DocumentId); var doc = _ctx.tblDocument.FirstOrDefault(s => s.Id == command.DocumentId); foreach (var tblLine in doc.tblLineItems) { tblLine.LineItemStatusId = (int)MainOrderLineItemStatus.Rejected; tblLine.LostSaleQuantity = tblLine.Quantity; } _ctx.SaveChanges(); } catch (Exception ex) { _log.ErrorFormat("Error Execute {1} - Command Id {0} ", command.CommandId, command.GetType().ToString()); _log.Error("RejectOrderCommandHandler exception", ex); throw; } }
public void Handle(RejectMainOrderCommand command) { var order = GetOrder(); if (order != null) { order.ProcessingStatus = ProcessingStatus.Rejected; } }