updateSchedule(schedule: Schedule) : Observable<any> {
        
        let url = global.url + "api/Schedules/" + schedule.Id;

        let body = JSON.stringify(schedule);
        let headers = new Headers({ 'Content-Type': 'application/json' });
        let options = new RequestOptions({ headers: headers });        

        return this.http.put(url, body, options)                         
                        .catch(this.handleError);
    }
    updateSingleNews(news: News) : Observable<any> {
        
        let url = global.url + "api/News/" + news.Id;

        let body = JSON.stringify(news);
        let headers = new Headers({ 'Content-Type': 'application/json' });
        let options = new RequestOptions({ headers: headers });        

        return this.http.put(url, body, options)                         
                        .catch(this.handleError);
    }
Example #3
0
 /**
  * Wrapper for HTTP PUT operation
  */
 public put(url: string, body?: string): Observable<any> {
     this._headers.set("Content-Type", "application/json");
     const options = new RequestOptions({headers: this._headers});
     if (body === null) {
       body = "";
     }
     return this._http
         .put(this._baseUrl + url, body, options)
         .map(response => this.mapResponse(response))
         .catch(error => this.handleError(error));
 }
    updateDivision(division: Division) : Observable<any> {
        
        let url = global.url + "api/Divisions/" + division.Id;

        let body = JSON.stringify(division);
        let headers = new Headers({ 'Content-Type': 'application/json' });
        let options = new RequestOptions({ headers: headers });        

        return this.http.put(url, body, options)                         
                        .catch(this.handleError);
    }
 modifyCustomer(customer: Customer): Promise<User> {
     let body = JSON.stringify({ customer });
     let headers = new Headers({ 'Content-Type': 'application/json' });
     let options = new RequestOptions({ headers: headers });
     return this.http.put('api/customer', body, options)
         .toPromise()
         .then(response => {
             return response.json();
         })
         .catch(this.handleError);
 }
    updateOrganization(organization: Organization) {
        let headers = this.getHeaders();

        // don't send userId as a parameter. The server validates the userId from the token in the header.
        let url = ROOT + '/Organization/Update';
        this.http.put(url, organization, { headers: headers })
            .subscribe((response: Response) => {
                this.cacheService.put(this.cacheKeys.Organization, null);
                this.emit(ServiceEvents.OrganizationUpdated);
            });
    }
  updatePlayer(player: Player): any {
    let url = CONFIG.apiUrl + '/players/' + player.playerId;

    let body = JSON.stringify(player);
    let headers = new Headers({'Content-Type': 'application/json'});
    let options = new RequestOptions({headers: headers});

    return this.http.put(url, body, options)
        .map(res => res.json()[0])
        .catch(this.helperService.handleError);
  }
 setPass(body: string, idUser: number, token): Observable<any> {
   const url = `${this.urlRecover }`;
   const headers = new Headers();
   headers.append('Content-Type', 'application/json');
   headers.append('Authorization', `Bearer ${token}`);
   const options = new RequestOptions({headers: headers, withCredentials: true});
   return this.http
     .put(url, body, options)
     .map(this.extractData)
     .catch(this.extractData);
 }
Example #9
0
 public stopTrip(trip:ITrip):Observable<ITrip> {
   console.log('stopping');
   console.log(JSON.stringify(trip));
   console.log(trip);
   console.log('done stopping');
   var headers = new Headers();
   trip.tripStatus = Trip.TRIP_STATUS_STOPPED;
   headers.append('Content-Type', 'application/json');
   return this.http.put(environment.API + '/trips/' + trip.id, JSON.stringify(trip), {headers: headers})
       .map(res => res.json());
 }
Example #10
0
 updateStudents(code: string, students: string[]) {
   return this.http.put("/api/subject/" + code + "/students", JSON.stringify({students: students}), {
     headers: authHeaders()
   }).map((res) => {
     if (res.status === 200) {
       return true;
     } else {
       return false;
     }
   });
 }