Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Validación parametro name.

  • Loading branch information...
commit b7cf6f84491d9c5143c24bccc5f80da9c070a9cf 1 parent de4ff2a
Santiago Rodriguez authored

Showing 1 changed file with 12 additions and 5 deletions. Show diff stats Hide diff stats

  1. +12 5 application/controllers/hotels.php
17 application/controllers/hotels.php
@@ -15,14 +15,21 @@ public function insertHotel() {
15 15 $name = $this->input->post('name');
16 16 $value = $this->input->post('valueReservation');
17 17
18   - $success = $this->Hotel->insertHotel($name, $value);
19   -
20   - if($success) {
21   - echo json_encode(array("success" => true));
  18 + // Se verifica que el nombre haya sido ingresado.
  19 + if($name) {
  20 + $success = $this->Hotel->insertHotel($name, $value);
  21 +
  22 + if($success) {
  23 + echo json_encode(array("success" => true));
  24 + }
  25 + else {
  26 + echo json_encode(array("success" => false, "message" => "Error inesperado en la DB"));
  27 + }
22 28 }
23 29 else {
24   - echo json_encode(array("success" => false, "message" => "Error inesperado en la DB"));
  30 + echo json_encode(array("success" => false, "message" => "El nombre es requerido"));
25 31 }
  32 +
26 33 }
27 34
28 35 }

0 comments on commit b7cf6f8

Please sign in to comment.
Something went wrong with that request. Please try again.