Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created November 9, 2019 02:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
/*
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