Exemple #1
0
 public bool Update(RentedVehicles entity)
 {
     try
     {
         bool isSuccess;
         using (var rentedVehicleRepo = new RentedVehicleRepository())
         {
             isSuccess = rentedVehicleRepo.Update(entity);
         }
         return(isSuccess);
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("CarRental.BusinessLogic.Concretes: " + entity.GetType().ToString() + "::Update:Error occured.", ex);
     }
 }
Exemple #2
0
 public bool ApproveOrDenyTheRequest(RentalRequests rentalRequests, bool isApprove, decimal rentalprice, int pickupkm, int dropoffkm)
 {
     try
     {
         bool isDeleteSuccess = false, isInsertSuccess = false;
         if (isApprove)
         {
             using (var rentedvehiclebusiness = new RentedVehicleBusiness())
             {
                 var rentedvehicle = new RentedVehicles();
                 rentedvehicle.DriverCustomerId  = rentalRequests.RentalRequestCustomerId;
                 rentedvehicle.DropOffDate       = rentalRequests.RequestedDropOffDate;
                 rentedvehicle.PickUpDate        = rentalRequests.RequestedPickUpDate;
                 rentedvehicle.RentalPrice       = rentalprice;
                 rentedvehicle.RentedVehicleId   = rentalRequests.RequestedVehicleId;
                 rentedvehicle.SupplierCompanyId = rentalRequests.RequestedSupplierCompanyId;
                 rentedvehicle.VehiclesPickUpKm  = pickupkm;
                 rentedvehicle.VehiclesDropOffKm = dropoffkm;
                 isInsertSuccess = rentedvehiclebusiness.Insert(rentedvehicle);
                 if (isInsertSuccess)
                 {
                     isDeleteSuccess = DeleteById(rentalRequests.RentalRequestId);
                 }
             }
         }
         else
         {
             isDeleteSuccess = DeleteById(rentalRequests.RentalRequestId);
         }
         return(isDeleteSuccess);
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("CarRental.BusinessLogic.Concretes:RentalRequestBusiness::ApproveOrDenyTheRequest:Error occured.", ex);
     }
 }