update(table, id, data) { this.http.put(this.url + table + '/' + id, data).subscribe( data => { console.log(data); this.getAll(table); }); }
//update existing hero private put(hero: Hero){ let headers = new Headers(); headers.append('Content-Type','application/json'); let url = `${this.heroesUrl}/${hero.id}`; return this.http.put(url,JSON.stringify(hero), {headers: headers}) .toPromise() .then(()=> hero) .catch(this.handleError); }
private update(article: Article): Promise<Article> { return this.http .put(`${this.articlesUrl}/${article.id}`, JSON.stringify(article), { headers: this.headers }) .toPromise() .then(() => article) .catch(this.handleError); }
put(path: string, body): Observable<any> { return this.http .put(`${this.api_url}${path}`, JSON.stringify(body), { headers: this.headers }) .map(this.checkForError) .catch(err => Observable.throw(err)) .map(this.getJson); }
public updateEmployees(newemployees: Employee[]) { this.updating = true; console.log('updating'); this.http.put(this.baseUrl + 'api/Employees/', newemployees).subscribe(result => { if (result.ok) { this.http.get(this.baseUrl + 'api/Employees').subscribe(newres => { if (newres.ok) { // alert('Updated'); this.employees = newres.json() as Employee[]; } this.updating = false; }, error => console.error(error)); } else { this.updating = false; } }, error => console.error(error)); }
updateScenario(scenario: ScenarioModel): Observable<ScenarioModel> { return this.http.put(this.baseUrl+'/update', scenario) .pipe( map( (scenario) => { return scenario.json() as ScenarioModel; }, (error) => { return error; } ) ) }
update_a_task(task_id, task) { var url = this.baseurl + 'tasks/' + task_id; return new Promise(resolve => { var headers: Headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); headers.append("Accept", "text/html; charset=UTF-8"); this.http.put(url, task, { headers: headers }).map(res => res.json()).subscribe(data => { console.log(data); this.data = data; resolve(this.data); }, error => { console.log(error.json()); }); }); }
updateSuite(suite: SuiteModel): Observable<SuiteModel> { return this.http.put(this.baseUrl+'/update', suite) .pipe( map( (suite) => { return suite.json() as SuiteModel; }, (error) => { return error; } ) ); }
updateFeature(feature: FeatureModel): Observable<FeatureModel> { return this.http.put(this.baseUrl+'/update', feature) .pipe( map( (feature) => { return feature.json() as FeatureModel; }, (error) => { return error; } ) ); }
editProject(project: ProjectModel): Observable<ProjectModel> { return this.http.put(this.baseUrl+'/update', project) .pipe( map( (project) => { return project.json() as ProjectModel; }, (error) => { return error; } ) ); }
editProject(project: ProjectModel): Observable<ProjectModel> { return this.http.put(this.baseUrl+'/update', project) .pipe( map( (project) => { return project.json() as ProjectModel; }, (error) => { return error; } ) ); }
updateFeature(feature: FeatureModel): Observable<FeatureModel> { return this.http.put(this.baseUrl+'/update', feature) .pipe( map( (feature) => { return feature.json() as FeatureModel; }, (error) => { return error; } ) ); }
updateSuite(suite: SuiteModel): Observable<SuiteModel> { return this.http.put(this.baseUrl+'/update', suite) .pipe( map( (suite) => { return suite.json() as SuiteModel; }, (error) => { return error; } ) ); }
updateScenario(scenario: ScenarioModel): Observable<ScenarioModel> { return this.http.put(this.baseUrl+'/update', scenario) .pipe( map( (scenario) => { return scenario.json() as ScenarioModel; }, (error) => { return error; } ) ) }
update_a_task(task_id, task) { var url = this.baseurl + 'tasks/' + task_id; return new Promise(resolve => { var headers: Headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); headers.append("Accept", "text/html; charset=UTF-8"); this.http.put(url, task, { headers: headers }).map(res => res.json()).subscribe(data => { console.log(data); this.data = data; resolve(this.data); }, error => { console.log(error.json()); }); }); }