public void ProcessAction(SupplyUpdatedEvent eventObject) { this.AppendInfoLog(string.Format("Fourniture id:'{0}' mise à jour", eventObject.SupplyId)); }
public void ProcessAction(SupplyUpdatedEvent eventObject) { if (CheckIfCurrentCatalog(eventObject)) return; var catalog = this.repository.FindById(eventObject.CatalogId); var supply = catalog.Supplies.Where(x => x.Id == eventObject.SupplyId).FirstOrDefault(); Mapper.CreateMap<Supply, CatalogSupplyViewModel>(); var result = Mapper.Map<Supply, CatalogSupplyViewModel>(supply); result.CatalogId = eventObject.CatalogId; this.catalogView.UpdateSupply(result); // update also the HardwareSupplies var hardwareToUpdates = catalog.Hardwares .Where(x => x.Components.Where(y => y.Supply.Id == eventObject.SupplyId).Any()) .Select(x => Map(eventObject.CatalogId, x)) .ToList(); this.catalogView.UpdateHardwares(hardwareToUpdates); }