private InvoiceProduct Map(Product product, OrderedProductModel order) { var result = mapper.Map <InvoiceProduct>(product); result.Amount = order.Amount; return(result); }
private static Product Translate(OrderedProductModel source, Category category) { return(new Product { Id = source.Id, Category = category, Options = source.CustomOptions.Select(Translate) }); }
private static (Guid, List <Guid>) GetProductsWithMissingOptions(RequestResult <Product, Guid> storedProducts, OrderedProductModel orderedProduct) { var storedProduct = storedProducts .GetList() .First(x => x.Id == orderedProduct.Id); var notExistingOptions = orderedProduct .CustomOptions .Select(x => x.Id) .Except(storedProduct.Options.Select(x => x.Id)) .ToList(); return(orderedProduct.Id, notExistingOptions); }