Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Validación parametro name.

  • Loading branch information...
commit b7cf6f84491d9c5143c24bccc5f80da9c070a9cf 1 parent de4ff2a
@sanrodari authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 application/controllers/hotels.php
View
17 application/controllers/hotels.php
@@ -15,14 +15,21 @@ public function insertHotel() {
$name = $this->input->post('name');
$value = $this->input->post('valueReservation');
- $success = $this->Hotel->insertHotel($name, $value);
-
- if($success) {
- echo json_encode(array("success" => true));
+ // Se verifica que el nombre haya sido ingresado.
+ if($name) {
+ $success = $this->Hotel->insertHotel($name, $value);
+
+ if($success) {
+ echo json_encode(array("success" => true));
+ }
+ else {
+ echo json_encode(array("success" => false, "message" => "Error inesperado en la DB"));
+ }
}
else {
- echo json_encode(array("success" => false, "message" => "Error inesperado en la DB"));
+ echo json_encode(array("success" => false, "message" => "El nombre es requerido"));
}
+
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.