Beispiel #1
0
        public void UpdateTruck(long TruckId, [FromBody] TruckForUpdating truck)
        {
            TruckDTO truckToReturn = _logicRepository.UpdateTruck(TruckId, truck);

            _logicRepository.Save();

            //return Ok(truckToReturn);
        }
        public void UpdateTruck(long TruckId, TruckForUpdating truck)
        {
            IsPresent(TruckId);

            _context.Database.ExecuteSqlRaw($"UPDATE avto.Truck " +
                                            $"SET Price = {truck.PriceUSD}," +
                                            $"Model = '{truck.Model}'," +
                                            $"YearGraduation = {truck.YearGraduation}" +
                                            $"WHERE Id = {TruckId};");
        }
        public TruckDTO UpdateTruck(long TruckId, TruckForUpdating truck)
        {
            IsPresent(TruckId);

            TruckDTO truckToReturn = GetTruckById(TruckId);

            truckToReturn.PriceUSD   = truck.PriceUSD;
            truckToReturn.Model      = truck.Model;
            truckToReturn.AmountYear = truck.YearGraduation.GetCurrentAge();



            return(truckToReturn);
        }
 public void UpdateTruck(long TruckId, [FromBody] TruckForUpdating truck)
 {
     _logicRepository.UpdateTruck(TruckId, truck);
     _logicRepository.Save();
 }