Ejemplo n.º 1
0
 public void Delete(int id)
 {
     var trip = new TripDa(databasecontext);
     if (id > 0)
     {
         var currentTrip = GetById(id);
         trip.Delete(currentTrip);
     }
 }
Ejemplo n.º 2
0
        public Trip Save(int id, DateTime DateTimeStart, DateTime DateTimeEnd, int VehicleId, int DriverId, int RefillId, decimal MileageStart, decimal MileageEnd, string TripDetails, string ExpenseAccount)
        {
            var trip = id > 0 ? GetById(id) : new Trip();

            trip.DateTimeStart = DateTimeStart;
            trip.DateTimeEnd = DateTimeEnd;
            trip.DriverId = DriverId;
            trip.VehicleId = VehicleId;
            trip.RefillId = RefillId;
            trip.MileageStart = MileageStart;
            trip.MileageEnd = MileageEnd;
            trip.TripDetails = TripDetails;
            trip.ExpenseAccount = ExpenseAccount;


            var tripDa = new TripDa(databasecontext);

            //if new
            if (id < 1) trip = tripDa.Add(trip);
            //update
            else trip = tripDa.Update(trip);
            return trip;
        }