예제 #1
0
 public int PutReceivingFuel(int id, [FromBody] ReceivingFuel value)
 {
     try
     {
         this.ef_rf.Update(value);
         return(this.ef_rf.Save());
     }
     catch (Exception e)
     {
         String.Format("Ошибка выполнения метода API:PutReceivingFuel(id={0}, value={1})", id, value).SaveError(e);
         return(-1);
     }
 }
예제 #2
0
 public int PostReceivingFuel([FromBody] ReceivingFuel value)
 {
     try
     {
         this.ef_rf.Add(value);
         this.ef_rf.Save();
         this.ef_rf.Refresh(value);
         return(value.id);
     }
     catch (Exception e)
     {
         String.Format("Ошибка выполнения метода API:PostReceivingFuel(value={0})", value).SaveError(e);
         return(-1);
     }
 }
예제 #3
0
 public IHttpActionResult GetReceivingFuel(int id)
 {
     try
     {
         ReceivingFuel rf = this.ef_rf.Get().Where(c => c.id == id)
                            .ToList()
                            .Select(s => new ReceivingFuel
         {
             id                    = s.id,
             operator_name         = s.operator_name,
             smena_num             = s.smena_num,
             smena_datetime        = s.smena_datetime,
             type                  = s.type,
             fuel                  = s.fuel,
             truck_num_nak         = s.truck_num_nak,
             truck_weight          = s.truck_weight,
             truck_provider        = s.truck_provider,
             railway_num_nak       = s.railway_num_nak,
             railway_num_tanker    = s.railway_num_tanker,
             railway_provider      = s.railway_provider,
             railway_type_capacity = s.railway_type_capacity,
             railway_nak_volume    = s.railway_nak_volume,
             railway_nak_dens      = s.railway_nak_dens,
             railway_nak_mass      = s.railway_nak_mass,
             railway_manual_level  = s.railway_manual_level,
             railway_manual_volume = s.railway_manual_volume,
             railway_manual_dens   = s.railway_manual_dens,
             railway_manual_mass   = s.railway_manual_mass,
             start_datetime        = s.start_datetime,
             stop_datetime         = s.stop_datetime,
             close                 = s.close,
             sending               = s.sending,
             ReceivingFuelTanks    = s.ReceivingFuelTanks.ToList().Select(t => new ReceivingFuelTanks
             {
                 id = t.id,
                 id_receiving_fuel = t.id_receiving_fuel,
                 num               = t.num,
                 fuel              = t.fuel,
                 start_datetime    = t.start_datetime,
                 start_level       = t.start_level,
                 start_volume      = t.start_volume,
                 start_density     = t.start_density,
                 start_mass        = t.start_mass,
                 start_temp        = t.start_temp,
                 start_water_level = t.start_water_level,
                 stop_datetime     = t.stop_datetime,
                 stop_level        = t.stop_level,
                 stop_volume       = t.stop_volume,
                 stop_density      = t.stop_density,
                 stop_mass         = t.stop_mass,
                 stop_temp         = t.stop_temp,
                 stop_water_level  = t.stop_water_level,
                 close             = t.close,
             }).ToList(),
         })
                            .FirstOrDefault();
         if (rf == null)
         {
             return(NotFound());
         }
         return(Ok(rf));
     }
     catch (Exception e)
     {
         String.Format("Ошибка выполнения метода API:GetReceivingFuel()").SaveError(e);
         return(NotFound());
     }
 }