Created
November 9, 2019 02:48
-
-
Save parzibyte/70b40331a81c46a8e53b2248afc005de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Programado por Luis Cabrera Benito | |
____ _____ _ _ _ | |
| _ \ | __ \ (_) | | | | |
| |_) |_ _ | |__) |_ _ _ __ _____| |__ _ _| |_ ___ | |
| _ <| | | | | ___/ _` | '__|_ / | '_ \| | | | __/ _ \ | |
| |_) | |_| | | | | (_| | | / /| | |_) | |_| | || __/ | |
|____/ \__, | |_| \__,_|_| /___|_|_.__/ \__, |\__\___| | |
__/ | __/ | | |
|___/ |___/ | |
Blog: https://parzibyte.me/blog | |
Ayuda: https://parzibyte.me/blog/contrataciones-ayuda/ | |
Contacto: https://parzibyte.me/blog/contacto/ | |
*/ | |
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { Mascota } from "./mascota" | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class MascotasService { | |
baseUrl = "http://localhost/mascotas_angular" | |
constructor(private http: HttpClient) { } | |
getMascotas() { | |
return this.http.get(`${this.baseUrl}/getAll.php`); | |
} | |
getMascota(id: string | number) { | |
return this.http.get(`${this.baseUrl}/get.php?idMascota=${id}`); | |
} | |
addMascota(mascota: Mascota) { | |
return this.http.post(`${this.baseUrl}/post.php`, mascota); | |
} | |
deleteMascota(mascota: Mascota) { | |
return this.http.delete(`${this.baseUrl}/delete.php?idMascota=${mascota.id}`); | |
} | |
updateMascota(mascota: Mascota) { | |
return this.http.put(`${this.baseUrl}/update.php`, mascota); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment