public async Task <IHttpActionResult> Putafiliacion(int id, afiliacion afiliacion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != afiliacion.Persona_id) { return(BadRequest()); } db.Entry(afiliacion).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!afiliacionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getafiliacion(int id) { afiliacion afiliacion = await db.afiliacions.FindAsync(id); if (afiliacion == null) { return(NotFound()); } return(Ok(afiliacion)); }
public async Task <IHttpActionResult> Postafiliacion(afiliacion afiliacion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.afiliacions.Add(afiliacion); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = afiliacion.Persona_id }, afiliacion)); }
public async Task <IHttpActionResult> Deleteafiliacion(int id) { afiliacion afiliacion = await db.afiliacions.FindAsync(id); if (afiliacion == null) { return(NotFound()); } db.afiliacions.Remove(afiliacion); await db.SaveChangesAsync(); return(Ok(afiliacion)); }
protected void Page_Load(object sender, EventArgs e) { tools _tools = new tools(); SecureQueryString QueryStringSeguro; QueryStringSeguro = new SecureQueryString(_tools.byteParaQueryStringSeguro(), Request["data"]); Decimal ID_CONTRATO = Convert.ToDecimal(QueryStringSeguro["contrato"]); String ENTIDAD_AFILIACION = QueryStringSeguro["afiliacion"]; afiliacion _afiliacion = new afiliacion(Session["idEmpresa"].ToString(), Session["USU_LOG"].ToString()); DataTable tablaResutato = _afiliacion.ObtenerDocsRadicacionPorCOntratoYEntidad(ID_CONTRATO, ENTIDAD_AFILIACION); DataRow filaInfoAdjunto = tablaResutato.Rows[0]; Response.Clear(); Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", "RADICACION_" + ENTIDAD_AFILIACION + "_" + ID_CONTRATO.ToString() + filaInfoAdjunto["ARCHIVO_RADICACION_EXTENSION"])); Response.ContentType = filaInfoAdjunto["ARCHIVO_RADICACION_TYPE"].ToString().Trim(); Response.BinaryWrite((byte[])filaInfoAdjunto["ARCHIVO_RADICACION"]); Response.End(); }