export class ListComponent implements OnInit{
public dataSource: IssueModel[];
constructor(private service: IssueApiService
, private router: Router
) { }
async ngOnInit() {
this.dataSource = await this.service.GetList();
}
}
export class IssueApiService extends BaseApiService {
constructor(public http: HttpClient) {
super('Issue', http)
}
public async GetList() {
return this.get<IssueModel[]>('GetList').toPromise();
}
public async Create(model: FormGroup) {
model.controls["type"].setValue(+model.controls["type"].value);
return this.post<number>('Create', model.value).toPromise();
}
public async Update(model: FormGroup) {
return this.post<number>('Update', model.value).toPromise();
}
public async Details(id: number) {
return this.get<any>('Details?id=' + id).toPromise();
}
}
public async getUser(userId: string) {
const profiles = await this.GetProfiles();
return profiles.find(x => x.id == userId);
}