public void WhenModificoLaNotaInformativa()
 {
     try
     {
         notaCEN.Modificar(notaId, nota.Titulo, nota.Cuerpo, DateTime.Now);
     }
     catch (Exception e)
     {
         ScenarioContext.Current.Add(exception, e);
     }
 }
        public HttpResponseMessage Modificar(int idNotaInformativa, [FromBody] NotaInformativaDTO dto)
        {
            // CAD, CEN, returnValue
            NotaInformativaRESTCAD notaInformativaRESTCAD = null;
            NotaInformativaCEN     notaInformativaCEN     = null;
            NotaInformativaDTOA    returnValue            = null;

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

            try
            {
                SessionInitializeTransaction();
                string token = "";
                if (Request.Headers.Authorization != null)
                {
                    token = Request.Headers.Authorization.ToString();
                }
                int id = new UsuarioCEN().CheckToken(token);



                notaInformativaRESTCAD = new NotaInformativaRESTCAD(session);
                notaInformativaCEN     = new NotaInformativaCEN(notaInformativaRESTCAD);

                // Modify
                notaInformativaCEN.Modificar(idNotaInformativa,
                                             dto.Titulo
                                             ,
                                             dto.Cuerpo
                                             ,
                                             dto.Fecha
                                             );

                // Return modified object
                returnValue = NotaInformativaAssembler.Convert(notaInformativaRESTCAD.ReadOIDDefault(idNotaInformativa), 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);
            }
        }