// GET: api/Themes/5/sharedWith/4 public void Get(String uidSolicitante, String uidSolicitado) { HttpResponseMessage respuesta; try { int numeroTemas = ThemesGetMethods.getNumeroTemasComunes(uidSolicitante, uidSolicitado); respuesta = numeroTemas == 0 ? Request.CreateResponse(HttpStatusCode.NoContent) : Request.CreateResponse(HttpStatusCode.OK, numeroTemas); } catch (SqlException sqlEx) { respuesta = Request.CreateErrorResponse(HttpStatusCode.ServiceUnavailable, "Error en la base de datos: " + sqlEx.StackTrace); } throw new HttpResponseException(respuesta); }
// GET: api/Themes/5 public void Get(String uidSolicitante) { HttpResponseMessage respuesta; List <Tema> listadoTemas = ThemesGetMethods.getListadoTemasDeUsuario(uidSolicitante); if (listadoTemas[0].Nombre.Contains("Error en la base de datos")) { respuesta = Request.CreateErrorResponse(HttpStatusCode.ServiceUnavailable, listadoTemas[0].Nombre); } else if (listadoTemas[0].Equals(new Tema())) { respuesta = Request.CreateResponse(HttpStatusCode.NoContent); } else { respuesta = Request.CreateResponse(HttpStatusCode.OK, listadoTemas); } throw new HttpResponseException(respuesta); }