Ejemplo n.º 1
0
 public Item UpdateObject(Item item, IUoMService _uomService, IItemTypeService _itemTypeService, IPriceMutationService _priceMutationService, IContactGroupService _contactGroupService)
 {
     if (_validator.ValidUpdateObject(item, _uomService, this, _itemTypeService))
     {
         ContactGroup  contactGroup     = _contactGroupService.GetObjectByIsLegacy(true);
         Item          olditem          = _repository.GetObjectById(item.Id); // Note: olditem might be pointing to the same memory with item (share the same contents)
         PriceMutation oldpriceMutation = _priceMutationService.GetObjectById(item.PriceMutationId);
         item.UpdatedAt = DateTime.Now;
         if (olditem.SellingPrice != item.SellingPrice)
         {
             PriceMutation priceMutation = _priceMutationService.CreateObject(item, /*contactGroup,*/ (DateTime)item.UpdatedAt.GetValueOrDefault());
             item.PriceMutationId = priceMutation.Id;
             _priceMutationService.DeactivateObject(oldpriceMutation, item.UpdatedAt);
         }
         item = _repository.UpdateObject(item);
     }
     return(item);
 }
Ejemplo n.º 2
0
 public Item UpdateObject(Item item, IUoMService _uomService, IItemTypeService _itemTypeService)
 {
     return(item = _validator.ValidUpdateObject(item, _uomService, this, _itemTypeService) ? _repository.UpdateObject(item) : item);
 }