本文整理汇总了C#中GenericRepository.GetCustomer方法的典型用法代码示例。如果您正苦于以下问题:C# GenericRepository.GetCustomer方法的具体用法?C# GenericRepository.GetCustomer怎么用?C# GenericRepository.GetCustomer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenericRepository
的用法示例。
在下文中一共展示了GenericRepository.GetCustomer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToCollection
private static IEnumerable<Order> ConvertToCollection(object[,] valueArray)
{
var orderList = new List<Order>();
var sqlGirlRepo = new GenericRepository<Girl>(new GirlsAgencyContext());
var sqlCustomerRepo = new GenericRepository<Customer>(new GirlsAgencyContext());
for (var row = 0; row < valueArray.GetLength(0); row++)
{
var girlFirstName = valueArray[row, 0].ToString();
var girlLastName = valueArray[row, 1].ToString();
var customerFirstName = valueArray[row, 2].ToString();
var customerLastName = valueArray[row, 3].ToString();
var duration = Convert.ToInt32(valueArray[row, 4]);
var dateTime = Convert.ToDateTime(valueArray[row, 5]);
var girlId = sqlGirlRepo.Search(n => n.FirstName == girlFirstName && n.LastName == girlLastName).First().Id;
var girlOBJ =
sqlGirlRepo.Search(n => n.FirstName == girlFirstName && n.LastName == girlLastName).First();
var customerId = sqlCustomerRepo.Search(n => n.FirstName == customerFirstName && n.LastName == customerLastName).First().Id;
var order = new Order
{
GirlId = girlId,
CustomerId = customerId,
Duration = duration,
Date = dateTime
};
var baihoi = sqlGirlRepo.GetCustomer(customerId);
girlOBJ.Customers.Add(baihoi);
sqlGirlRepo.SaveChanges();
//order.Girl.Customers.Add(sqlCustomerRepo.GetCustomer(customerId));
orderList.Add(order);
}
return orderList;
}