Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. export class Paei {
  2.  
  3. constructor(
  4. public person_id: number,
  5. public date: string,
  6. public skill_p: number,
  7. public skill_a: number,
  8. public skill_e: number,
  9. public skill_i: number
  10. ) {}
  11. }
  12.  
  13. pushPaei() {
  14. this.skilldata = this.valuesService.getSkillResult();
  15.  
  16. console.log(this.skilldata);
  17.  
  18. this.paei = new Paei(
  19. this.personId,
  20. moment().format('DD.MM.YYYY HH:mm:ss'),
  21. this.skilldata[0],
  22. this.skilldata[1],
  23. this.skilldata[2],
  24. this.skilldata[3]
  25. );
  26.  
  27. console.log(this.paei);
  28.  
  29. this.sub2 = this.paeiService.addPaei(this.paei)
  30. .subscribe(() => {});
  31.  
  32. this.router.navigate(['/assessment/paei-result', this.personId]);
  33.  
  34. }
  35.  
  36. import { Injectable } from '@angular/core';
  37. import { HttpClient } from '@angular/common/http';
  38. import { Observable } from 'rxjs';
  39.  
  40. import { Paei } from 'src/app/assessment/paei-test/models/paei.model';
  41. import { BaseApi } from '../core/base-api';
  42.  
  43. @Injectable()
  44.  
  45. export class PaeiService extends BaseApi {
  46. paei: Paei;
  47.  
  48. constructor(public http: HttpClient) {
  49. super(http);
  50. }
  51.  
  52. addPaei(paei: Paei): Observable<Paei> {
  53.  
  54. console.log(this.paei);
  55.  
  56. return this.post('paei', paei);
  57. }
  58.  
  59. updatePaei(paei: Paei): Observable<Paei> {
  60. return this.put(`paei/${paei.person_id}`, paei);
  61. }
  62.  
  63. deletePaeiById(id: number): Observable<Paei> {
  64. return this.delete(`paei/${id}`);
  65. }
  66.  
  67. getPaeiById(id: number): Observable<Paei> {
  68. return this.get(`paei/${id}`);
  69. }
  70.  
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement