Ejemplo n.º 1
0
 public void ProcessAction(SupplyUpdatedEvent eventObject)
 {
     this.AppendInfoLog(string.Format("Fourniture id:'{0}' mise à jour", eventObject.SupplyId));
 }
Ejemplo n.º 2
0
        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);
        }