public async Task <ProductDto> GetProductDetails(Guid ownerId, Guid productId) { GetProductDetails operation = new GetProductDetails(_authorityContext, ownerId, productId); Product product = await operation.Do(); return(product.ToDto()); }
public async Task <IEnumerable <Policy> > GetPolicies(Guid userId, Guid productId) { GetProductDetails operation = new GetProductDetails(_authorityContext, userId, productId); Product product = await operation.Do(); return(product.Policies); }
private decimal price(OrderDetails orderDetails) { decimal productValue = 0; GetProductDetails getProductDetails = new GetProductDetails(); int quantity = orderDetails.quantity; decimal?outPutprice = getProductDetails.GetIndividualProductDetail(orderDetails.productid).price; decimal price = (decimal)(outPutprice != null ? outPutprice : 0); orderDetails.price = price; productValue = quantity * price; return(productValue); }
internal static IEndpointRouteBuilder UseGetProductDetailsEndpoint(this IEndpointRouteBuilder endpoints) { endpoints.MapGet("/api/products/{id}", async context => { // var dbContext = WarehouseDBContextFactory.Create(); // var handler = new HandleGetProductDetails(dbContext.Set<Product>().AsQueryable()); var productId = context.FromRoute <Guid>("id"); var query = GetProductDetails.Create(productId); var result = await context .SendQuery <GetProductDetails, ProductDetails?>(query); if (result == null) { context.NotFound(); return; } await context.OK(result); }); return(endpoints); }
public ProductDetails Handle(GetProductDetails query) { return(Mapper.Map <ProductDetails>( _architectureContext.Products.Find(query.Id))); }