import { Injectable } from '@angular/core';
import {HttpHeaders, HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {Vendor} from './vendor';
import { environment } from '../../../environments/environment';
let header  = new HttpHeaders();

header = header.set('Content-Type', 'application/json; charset=utf-8');

@Injectable({
  providedIn: 'root'
})
export class VendorService {

  constructor(private httpClient: HttpClient) { }

  baseUrl: string = environment.serviceUrl;

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/VendorApi');
  }
   // httpclient post method
   Post(data: Vendor): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/VendorApi/Add', data,
      { headers: header, observe: 'response' });
  }
  // httpclient put method
  Put(data: Vendor): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/VendorApi/Update', data, { headers: header, observe: 'response' });
  }
  // httpclient delete method
  Delete(data: Vendor): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/VendorApi/activeordeactive', data, { headers: header, observe: 'response' });
  }

}
