public void Apply(ProductPriceChanged @event) { // var view = locator.ProductView; var product = view.GetById(@event.Id); product.Price = @event.NewPrice; }
public void Should_retrieve_product_when_given_a_known_product_id() { var id = productView.GetAll().First().Id; var p = productView.GetById(id); Assert.Equal(id, p.Id); }
public ActionResult Get(Guid id) { try { var dto = view.GetById(id); return(Ok(dto)); } catch (ReadModelNotFoundException) { return(NotFound()); } }
void ValidateProduct(Guid productId) { if (productId != Guid.Empty) { try { productView.GetById(productId); } catch (Exception) { throw new ArgumentOutOfRangeException("productId", "Invalid product identifier specified: the product cannot be found."); } } }
public void Apply(OrderPlaced e) { var productView = new ProductView(); var product = productView.GetById(e.ProductId); var dto = new OrderDto { Id = e.Id, Quantity = e.Quantity, ProductName = product.Description, Version = e.Version, IsPaidFor = false }; repository.Insert(dto); }