示例#1
0
 public static BossesZoneEntity ToEntity(this BossesZoneModel BZM)
 {
     if (BZM != null)
     {
         BossesZoneEntity BZE = new BossesZoneEntity();
         BZE.BossId = BZM.Zone.Id;
         BZE.ZoneId = BZM.Boss.Id;
         BZE.Id     = BZM.Id;
         BZE.Active = BZM.Active;
         return(BZE);
     }
     else
     {
         return(null);
     }
 }
示例#2
0
 public static BossesZoneModel ToModel(this BossesZoneEntity BZE)
 {
     if (BZE != null)
     {
         BossRepository  repoBoss = new BossRepository();
         ZoneRepository  repoZone = new ZoneRepository();
         BossesZoneModel BZM      = new BossesZoneModel();
         BZM.Boss   = repoBoss.GetOne(BZE.BossId).MapTo <BossModel>();
         BZM.Zone   = repoZone.GetOne(BZE.ZoneId).MapTo <ZoneModel>();
         BZM.Active = BZE.Active;
         BZM.Id     = BZE.Id;
         return(BZM);
     }
     else
     {
         return(null);
     }
 }