private void Save(HealthPlanCriteriaAssignmentEntity entity) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { if (!adapter.SaveEntity(entity, true)) { throw new PersistenceFailureException(); } } }
public void UpdateHealthPlanCriteriaAssignment(IEnumerable <CallQueueAssignmentEditModel> assignments) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { foreach (var assignment in assignments) { var entity = new HealthPlanCriteriaAssignmentEntity(assignment.HealthPlanCriteriaId, assignment.AssignedOrgRoleUserId) { StartDate = assignment.StartDate, EndDate = assignment.EndDate }; var bucket = new RelationPredicateBucket(HealthPlanCriteriaAssignmentFields.AssignedToOrgRoleUserId == assignment.AssignedOrgRoleUserId); bucket.PredicateExpression.AddWithAnd(HealthPlanCriteriaAssignmentFields.HealthPlanCriteriaId == assignment.HealthPlanCriteriaId); adapter.UpdateEntitiesDirectly(entity, bucket); } } }