public HttpResponseMessage Borrar(int p_notainformativa_oid) { // CAD, CEN NotaInformativaRESTCAD notaInformativaRESTCAD = null; NotaInformativaCEN notaInformativaCEN = 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); notaInformativaCEN.Borrar(p_notainformativa_oid); 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 204 - No Content return(this.Request.CreateResponse(HttpStatusCode.NoContent)); }
public void WhenEliminoLaNotaInformativa() { try { notaCEN.Borrar(notaId); } catch (Exception e) { ScenarioContext.Current.Add(exception, e); } }
public static void CleanData() { notaCEN.Borrar(notaId); notaCEN.Borrar(notaId2); }