Beispiel #1
0
        public JsonResult Get()
        {
            EstadiaModel estadiaQuery = new EstadiaModel(new Estadia());

            ResponseMenssage response = new ResponseMenssage("success", estadiaQuery.GetEstadias());

            return(new JsonResult(response));
        }
Beispiel #2
0
        public JsonResult Post([FromBody] Estadia estadia)
        {
            EstadiaModel EstadiaeQuery = new EstadiaModel(estadia);

            if (EstadiaeQuery.Create())
            {
                ResponseMenssage response = new ResponseMenssage("success", EstadiaeQuery.Estadia);
                return(new JsonResult(response));
            }
            else
            {
                ResponseMenssage response = new ResponseMenssage("error", "error al crear");
                return(new JsonResult(response));
            }
        }
Beispiel #3
0
        public JsonResult Delete(int id)
        {
            EstadiaModel estadiaQuery = new EstadiaModel(new Estadia());

            estadiaQuery.Estadia.Id = id;

            if (estadiaQuery.Delete())
            {
                ResponseMenssage response = new ResponseMenssage("success", estadiaQuery.Estadia);
                return(new JsonResult(response));
            }
            else
            {
                ResponseMenssage response = new ResponseMenssage("error", "error al eliminar");
                return(new JsonResult(response));
            }
        }
Beispiel #4
0
        public JsonResult Put(int id, [FromBody] Estadia estadia)
        {
            EstadiaModel estadiaQuery = new EstadiaModel(estadia);

            estadiaQuery.Estadia.Id = id;

            if (estadiaQuery.Update())
            {
                ResponseMenssage response = new ResponseMenssage("success", estadiaQuery.Estadia);
                return(new JsonResult(response));
            }
            else
            {
                ResponseMenssage response = new ResponseMenssage("error", "error al modificar");
                return(new JsonResult(response));
            }
        }
Beispiel #5
0
        public JsonResult Get(int id)
        {
            Estadia estadia = new Estadia
            {
                Id = id
            };
            EstadiaModel estadiaQuery = new EstadiaModel(estadia);


            if (estadiaQuery.ReadById())
            {
                ResponseMenssage response = new ResponseMenssage("success", estadiaQuery.Estadia);
                return(new JsonResult(response));
            }
            else
            {
                ResponseMenssage response = new ResponseMenssage("error", "estadia no encontrada");
                return(new JsonResult(response));
            }
        }