Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UpdateProductHandler
- {
- private readonly ISession session;
- public UpdateProductHandler(ISession session)
- {
- this.session = session;
- }
- public async Task Update(int id, ProductIdentity productIdentity)
- {
- var product = session.Get(id);
- product.Update(productIdentity);
- }
- }
- class GetProductHandler
- {
- private readonly ISession session;
- public GetProductHandler(ISession session)
- {
- this.session = session;
- }
- public async Task<Product> Get(int id)
- {
- var product = session.Get(id);
- if (product == null)
- throw new Exception("Entity not found");
- return Task.FromResult(product);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement