public async Task UpdateManifestManagement(Guid manifestManagementId, ManifestDTO manifestManagement) { var existingManifestManagement = await _repository.GetAsync(manifestManagementId); if (existingManifestManagement == null) { throw await _serviceHelper.GetExceptionAsync(ErrorConstants.MANIFEST_MANAGEMENT_NOT_EXIST); } var listOfSeat = await _seatManagemengtSvc.GetByVehicleTripIdAsync( existingManifestManagement.VehicleTripRegistrationId); existingManifestManagement.NumberOfSeats = listOfSeat.Count; //existingManifestManagement.IsPrinted = manifestManagement.IsPrinted; var tripRegistration = await _vehicleTripRepo.GetAsync(existingManifestManagement.VehicleTripRegistrationId); if (manifestManagement.IsPrinted) { await _journeyMgtSvc.AddJourneyManagementFromManifest(existingManifestManagement.VehicleTripRegistrationId, JourneyType.Loaded); } await _unitOfWork.SaveChangesAsync(); }
public async Task <IServiceResponse <bool> > OpenManifest(ManifestDTO query) { return(await HandleApiOperationAsync(async() => { await _service.UpdateOpenManifest(query.VehicleTripRegistrationId); return new ServiceResponse <bool>(true); })); }
public async Task <IServiceResponse <bool> > AddManifestManagement(ManifestDTO manifestManagement) { return(await HandleApiOperationAsync(async() => { await _service.AddManifest(manifestManagement); return new ServiceResponse <bool>(true); })); }
public async Task AddManifest(ManifestDTO manifest) { var existingManifestManagement = await GetManifestManagementsByVehicleTripIdAsync(manifest.VehicleTripRegistrationId); var vehicleTripReg = await _vehicleTripRepo.GetAsync(manifest.VehicleTripRegistrationId); if (existingManifestManagement != null) { existingManifestManagement.IsPrinted = manifest.IsPrinted; existingManifestManagement.ManifestPrinted = manifest.ManifestPrinted; await UpdateManifestManagement(existingManifestManagement.Id, existingManifestManagement); } else { var listOfSeat = await _seatManagemengtSvc.GetByVehicleTripIdAsync( manifest.VehicleTripRegistrationId); var fare = await GetTripFare(manifest.VehicleTripRegistrationId); decimal?amount = fare?.Amount; _repository.Insert(new Manifest { NumberOfSeats = listOfSeat.Count, Employee = _serviceHelper.GetCurrentUserEmail(), VehicleTripRegistrationId = manifest.VehicleTripRegistrationId, Amount = amount, VehicleModelId = vehicleTripReg.VehicleModelId }); await _unitOfWork.SaveChangesAsync(); } }