Exemplo n.º 1
0
 public static bool IsReverseRelationExists(this List <Relation> relations, Relation relation)
 {
     return
         (relations.FirstOrDefault(
              r =>
              r.SourcePerson == relation.DestinationPerson && r.DestinationPerson == relation.SourcePerson &&
              r.RelationType == relation.RelationType.GetReverseType()) != null);
 }
Exemplo n.º 2
0
 public static Relation GetReverseRelation(this Relation relation)
 {
     return(new Relation
     {
         SourcePerson = relation.DestinationPerson,
         DestinationPerson = relation.SourcePerson,
         RelationType = relation.RelationType.GetReverseType()
     });
 }
Exemplo n.º 3
0
 public static Dal.Model.Relation ConvertToDalRelation(this Relation relation)
 {
     return(new Dal.Model.Relation
     {
         ParentId = relation.SourcePerson.Id,
         ChildId = relation.DestinationPerson.Id,
         RelationId = relation.RelationId,
         RelationType = (int)relation.RelationType
     });
 }
Exemplo n.º 4
0
        public static Relation ConvertToViewRelation(this Dal.Model.Relation r, Func <int, Person> findPersonFunc)
        {
            var result = new Relation
            {
                RelationId        = r.RelationId,
                SourcePerson      = findPersonFunc(r.ParentId),
                DestinationPerson = findPersonFunc(r.ChildId),
                RelationType      = (RelationType)r.RelationType
            };

            return(result);
        }