Пример #1
0
 public MBatteryStorage buildStorage(BatteryStorage bs)
 {
     MBatteryStorage storage = new MBatteryStorage()
     {
         id = bs.Id,
         type = new MBatteryType() { id = (int)bs.btId },
         periods = dbPeriod.getStoragePeriods(bs.Id, true),
         storageNumber = bs.storageNumber.Value,
     };
     return storage;
 }
Пример #2
0
 public MBatteryStorage getRecordByType(int btid, bool getAssociation)
 {
     using (ElectricCarEntities context = new ElectricCarEntities())
     {
         MBatteryStorage storage = new MBatteryStorage();
         try
         {
             BatteryStorage s = context.BatteryStorages.Where(bs => bs.btId == btid).FirstOrDefault();
             storage = buildStorage(s);
             return storage;
         }
         catch (Exception)
         {
             return null;
         }
     }
 }