54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
|
import { Observable } from 'rxjs';
|
|
import { map } from 'rxjs/operators';
|
|
|
|
import { DropZoneResp } from '../models/dropzone';
|
|
import { JumpResp, JumpReq } from '../models/jump';
|
|
import { AircraftResp } from '../models/aircraft';
|
|
import { JumpTypeResp } from '../models/jumpType';
|
|
import { StatsResp, StatsByDzResp, StatsByAircraftResp, StatsByJumpTypeResp, StatsByRigResp, StatsByYearResp } from '../models/statsresp';
|
|
|
|
|
|
@Injectable()
|
|
export class ServiceApiPost {
|
|
private readonly headers = new HttpHeaders({
|
|
'Access-Control-Allow-Origin': 'http://localhost:5000',
|
|
});
|
|
constructor(private http: HttpClient) { }
|
|
|
|
|
|
|
|
public AddJump(selectedJumpType: number,
|
|
selectedAircraft: number,
|
|
selectedDz: number,
|
|
selectedRig: number,
|
|
withCutaway: boolean,
|
|
beginDate: Date,
|
|
endDate: Date,
|
|
defaultExitAltitude: number,
|
|
defaultDeployAltitude: number,
|
|
countOfJumps: number) {
|
|
|
|
const bodyNewjump: JumpReq = {
|
|
jumpTypeId: selectedJumpType,
|
|
aircraftId: selectedAircraft,
|
|
dropZoneId: selectedDz,
|
|
withCutaway: withCutaway,
|
|
//beginDate: beginDate,
|
|
//endDate: endDate,
|
|
exitAltitude: defaultExitAltitude,
|
|
deployAltitude: defaultDeployAltitude,
|
|
//countOfJumps: countOfJumps
|
|
gearId: selectedRig,
|
|
notes: '',
|
|
id: 0
|
|
};
|
|
|
|
this.http.post('http://localhost:5000/api/Jump',
|
|
bodyNewjump,
|
|
{ headers: this.headers })
|
|
.subscribe(data => console.log(data));
|
|
}
|
|
}
|