本文整理汇总了C#中ICustomerRepository.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# ICustomerRepository.Remove方法的具体用法?C# ICustomerRepository.Remove怎么用?C# ICustomerRepository.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICustomerRepository
的用法示例。
在下文中一共展示了ICustomerRepository.Remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateCaseLabels
private void UpdateCaseLabels(ICustomerRepository repository)
{
//delete old values
var originalLabels = InnerItem.Labels.ToList();
foreach (var labelItem in originalLabels)
{
if (CaseDetailViewModel.CaseLabelList.All(l => l.LabelId != labelItem.LabelId))
{
InnerItem.Labels.Remove(labelItem);
repository.Attach(labelItem);
repository.Remove(labelItem);
}
}
//add new values
foreach (var labelItem in CaseDetailViewModel.CaseLabelList)
{
if (_originalItem.Labels.All(l => l.LabelId != labelItem.LabelId))
{
labelItem.CaseId = InnerItem.CaseId;
repository.Add(labelItem);
InnerItem.Labels.Add(labelItem);
}
}
repository.UnitOfWork.Commit();
}
示例2: UpdateContactLabels
private void UpdateContactLabels(ICustomerRepository repository)
{
//delete old values
var originalValues = CurrentCustomer.Labels.ToList();
foreach (var labelItem in originalValues)
{
if (CustomerDetailViewModel.ContactLabels.All(l => l.LabelId != labelItem.LabelId))
{
if (CurrentCustomer == null)
break;
CurrentCustomer.Labels.Remove(labelItem);
repository.Attach(labelItem);
repository.Remove(labelItem);
}
}
//add new values
foreach (var labelItem in CustomerDetailViewModel.ContactLabels)
{
if (_originalContact.Labels.All(l => l.LabelId != labelItem.LabelId))
{
if (CurrentCustomer == null)
break;
labelItem.MemberId = CurrentCustomer.MemberId;
repository.Add(labelItem);
CurrentCustomer.Labels.Add(labelItem);
}
}
repository.UnitOfWork.Commit();
}
示例3: RemoveCaseDependentItems
private void RemoveCaseDependentItems(ICustomerRepository repository, string caseIdToDelete)
{
//remove labels
var labels = repository.Labels.Where(l => l.CaseId == caseIdToDelete).ToList();
Parallel.ForEach(labels, l =>
{
l.CaseId = null;
repository.Remove(l);
});
//remove notes
var notes = repository.Notes.Where(n => n.CaseId == caseIdToDelete).ToList();
Parallel.ForEach(notes, n =>
{
n.CaseId = null;
repository.Remove(n);
});
//remove communication items (public reply)
var communicationItems =
repository.CommunicationItems.Where(c => c.CaseId == caseIdToDelete).ToList();
Parallel.ForEach(communicationItems, c =>
{
c.CaseId = null;
repository.Remove(c);
});
}