import { History } from './../models/history';
import { BackendService } from './backend.service';
import { Http, Response, Headers, Request, RequestOptions, RequestMethod } from '@angular/http';
import { Injectable } from '@angular/core';
import 'rxjs/add/operator/map';

@Injectable()
export class HistoryService {

  constructor(private backendService: BackendService) { 
  }

  private historyUrl: string = '/historys';

  get(id?: string) {
      let dataId = id ? id : '';
      if (dataId) {
          return this.backendService.get(this.historyUrl + '/' + dataId);
      } else {
          return this.backendService.get(this.historyUrl);
      }
    }

  
(body: History) {
      return this.backendService.post(this.historyUrl, body);
    }

  put(body: History) {
      return this.backendService.put(this.historyUrl, body);
    }

  delete(body: History) {
      body.deleted = true;
      return this.backendService.put(this.historyUrl, body);
    }
}
post