public HttpResponseMessage RecuperarPassword(int idUsuarioWebNoRegistrado, [FromBody] UsuarioWebDTO dto)
        {
            // CAD, CEN, returnValue
            UsuarioWebNoRegistradoRESTCAD usuarioWebNoRegistradoRESTCAD = null;
            UsuarioWebCEN usuarioWebCEN            = null;
            UsuarioWebNoRegistradoDTOA returnValue = null;

            // HTTP response
            HttpResponseMessage response = null;
            string uri = null;

            try
            {
                SessionInitializeTransaction();


                usuarioWebNoRegistradoRESTCAD = new UsuarioWebNoRegistradoRESTCAD(session);
                usuarioWebCEN = new UsuarioWebCEN(usuarioWebNoRegistradoRESTCAD);

                // Modify
                usuarioWebCEN.RecuperarPassword(idUsuarioWebNoRegistrado,
                                                dto.Pass
                                                );

                // Return modified object
                returnValue = UsuarioWebNoRegistradoAssembler.Convert(usuarioWebNoRegistradoRESTCAD.ReadOIDDefault(idUsuarioWebNoRegistrado), session);

                SessionCommit();
            }

            catch (Exception e)
            {
                SessionRollBack();

                if (e.GetType() == typeof(HttpResponseException))
                {
                    throw e;
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto"))
                {
                    throw new HttpResponseException(HttpStatusCode.Forbidden);
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.DataLayerException))
                {
                    throw new HttpResponseException(HttpStatusCode.BadRequest);
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }
            finally
            {
                SessionClose();
            }

            // Return 404 - Not found
            if (returnValue == null)
            {
                return(this.Request.CreateResponse(HttpStatusCode.NotFound));
            }
            // Return 200 - OK
            else
            {
                response = this.Request.CreateResponse(HttpStatusCode.OK, returnValue);
                return(response);
            }
        }
        public HttpResponseMessage BuscarTodos()
        {
            // CAD, CEN, EN, returnValue
            UsuarioWebNoRegistradoRESTCAD usuarioWebNoRegistradoRESTCAD = null;
            UsuarioWebCEN usuarioWebCEN = null;

            List <UsuarioWebEN> usuarioWebEN = null;
            List <UsuarioWebNoRegistradoDTOA> returnValue = null;

            try
            {
                SessionInitializeWithoutTransaction();


                usuarioWebNoRegistradoRESTCAD = new UsuarioWebNoRegistradoRESTCAD(session);
                usuarioWebCEN = new UsuarioWebCEN(usuarioWebNoRegistradoRESTCAD);

                // Data
                // TODO: paginación

                usuarioWebEN = usuarioWebCEN.BuscarTodos(0, -1).ToList();

                // Convert return
                if (usuarioWebEN != null)
                {
                    returnValue = new List <UsuarioWebNoRegistradoDTOA>();
                    foreach (UsuarioWebEN entry in usuarioWebEN)
                    {
                        returnValue.Add(UsuarioWebNoRegistradoAssembler.Convert(entry, session));
                    }
                }
            }

            catch (Exception e)
            {
                if (e.GetType() == typeof(HttpResponseException))
                {
                    throw e;
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto"))
                {
                    throw new HttpResponseException(HttpStatusCode.Forbidden);
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.DataLayerException))
                {
                    throw new HttpResponseException(HttpStatusCode.BadRequest);
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }
            finally
            {
                SessionClose();
            }

            // Return 204 - Empty
            if (returnValue == null || returnValue.Count == 0)
            {
                return(this.Request.CreateResponse(HttpStatusCode.NoContent));
            }
            // Return 200 - OK
            else
            {
                return(this.Request.CreateResponse(HttpStatusCode.OK, returnValue));
            }
        }
        public HttpResponseMessage Crear([FromBody] UsuarioWebDTO dto)
        {
            // CAD, CEN, returnValue, returnOID
            UsuarioWebNoRegistradoRESTCAD usuarioWebNoRegistradoRESTCAD = null;
            UsuarioWebCEN usuarioWebCEN            = null;
            UsuarioWebNoRegistradoDTOA returnValue = null;
            int returnOID = -1;

            // HTTP response
            HttpResponseMessage response = null;
            string uri = null;

            try
            {
                SessionInitializeTransaction();


                usuarioWebNoRegistradoRESTCAD = new UsuarioWebNoRegistradoRESTCAD(session);
                usuarioWebCEN = new UsuarioWebCEN(usuarioWebNoRegistradoRESTCAD);

                // Create
                returnOID = usuarioWebCEN.Crear(
                    //Atributo Primitivo: p_nombre
                    dto.Nombre,                                                                                                                                             //Atributo Primitivo: p_apellidos
                    dto.Apellidos,                                                                                                                                          //Atributo Primitivo: p_email
                    dto.Email,                                                                                                                                              //Atributo Primitivo: p_pass
                    dto.Pass);
                SessionCommit();

                // Convert return
                returnValue = UsuarioWebNoRegistradoAssembler.Convert(usuarioWebNoRegistradoRESTCAD.ReadOIDDefault(returnOID), session);
            }

            catch (Exception e)
            {
                SessionRollBack();

                if (e.GetType() == typeof(HttpResponseException))
                {
                    throw e;
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto"))
                {
                    throw new HttpResponseException(HttpStatusCode.Forbidden);
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.DataLayerException))
                {
                    throw new HttpResponseException(HttpStatusCode.BadRequest);
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }
            finally
            {
                SessionClose();
            }

            // Return 201 - Created
            response = this.Request.CreateResponse(HttpStatusCode.Created, returnValue);

            // Location Header

            /*
             * Dictionary<string, object> routeValues = new Dictionary<string, object>();
             *
             * // TODO: y rolPaths
             * routeValues.Add("id", returnOID);
             *
             * uri = Url.Link("GetOIDUsuarioWebNoRegistrado", routeValues);
             * response.Headers.Location = new Uri(uri);
             */

            return(response);
        }