本文整理汇总了C#中IDocumentService.GetById方法的典型用法代码示例。如果您正苦于以下问题:C# IDocumentService.GetById方法的具体用法?C# IDocumentService.GetById怎么用?C# IDocumentService.GetById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDocumentService
的用法示例。
在下文中一共展示了IDocumentService.GetById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToDomainModel
// Converts EF Income model to the view Income Model
public static IncomeEFModel ToDomainModel(this IncomeMVCModel incomeModel, IDocumentService<IncomeEFModel> incomeService,
ICatalogService<ProductEFModel> productService, ICatalogService<SizeEFModel> sizeService)
{
if (incomeModel == null)
{
return null;
}
var incomeDomain = incomeService.GetById(incomeModel.Id);
if (incomeDomain == null)
{
throw new ArgumentException(String.Format("Income with ID={0} not found.", incomeModel.Id), "incomeModel.Id");
}
incomeDomain.Products.Clear();
foreach (var productModelDetails in incomeModel.Products)
{
foreach (var sizeModelDetails in productModelDetails.Sizes.Where(s => s.QuantityOrdered != 0 || s.QuantityReceived != 0))
{
incomeDomain.Products.Add(new IncomeProductsEFModel
{
Price = productModelDetails.Price,
Product = productModelDetails.Product.ToDomainModel(productService),
Size = sizeModelDetails.Size.ToDomainModel(sizeService),
QuantityOrdered = sizeModelDetails.QuantityOrdered,
QuantityReceived = sizeModelDetails.QuantityReceived
});
}
}
return incomeDomain;
}