private void RetireCarByID(int id) { CarRetire cr = new CarRetire { CarId = id, FlaggedForRetiringDate = DateTime.Now, Retired = false }; carRepository.RetireCar(cr); eventsService.CreateRetireCarEvent(cr); }
internal void CreateRemovedCarEvent(CarRetire car) { Events x = new Events() { EventType = (int)EventType.CarRemoved, CarId = car.CarId, CustomerId = null, BookingId = null, Date = DateTime.Now }; eventsRepository.SaveEvent(x); }
internal void RemoveCars(CarsRemoveVM[] viewModel) { foreach (var item in viewModel) { if (item.Remove) { CarRetire car = new CarRetire { CarId = item.CarId, FlaggedForRetiringDate = DateTime.Now, Retired = true, RetiredDate = DateTime.Now }; if (carRepository.Delete(car).Id > 0) { eventsService.CreateRemovedCarEvent(car); } } } }
public CarRetire Delete(CarRetire carToDelete) { context.CarRetire.Add(carToDelete); context.SaveChanges(); return(carToDelete); }
public void RetireCar(CarRetire cr) { context.CarRetire.Add(cr); context.SaveChanges(); }