import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { MailField } from './mailfield';
import { environment } from 'src/environments/environment';
import {  HttpClient } from '@angular/common/http';

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

  constructor(private httpClient: HttpClient) { }

  baseUrl: string = environment.serviceUrl;

  Get(): Observable<any> {
    return this.httpClient.get<any>(this.baseUrl + 'api/MailFieldApi');
  }

   // httpclient post method
   Post(mailfieldmodel: MailField): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/MailFieldApi/add', mailfieldmodel,
      {  observe: 'response' });
  }
  // httpclient put method
  Put(mailfieldmodel: MailField): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/MailFieldApi/Update', mailfieldmodel,
      {  observe: 'response' });
  }
  // httpclient delete method
  Delete(mailfieldmodel: MailField): Observable<any> {
    return this.httpClient.post<any>(this.baseUrl + 'api/MailFieldApi/activeordeactive', 
    mailfieldmodel, {  observe: 'response' })
  }

}
