POST required to generate the Pdf resource

main
Paul Schneider 9 years ago
parent 78cda65742
commit aa966aaa83
1 changed files with 1 additions and 21 deletions

@ -76,36 +76,16 @@ namespace Yavsc.ApiControllers
return File(fi.OpenRead(), "application/x-pdf", filename); ; return File(fi.OpenRead(), "application/x-pdf", filename); ;
} }
[HttpGet("GetComponents", Name = "GetComponents")]
public IActionResult GetComponents()
{
return Ok(provider);
}
[HttpGet("estimate-{id}.tex", Name = "GetTex"), Authorize] [HttpGet("estimate-{id}.tex", Name = "GetTex"), Authorize]
public IActionResult GetTex(long id) public IActionResult GetTex(long id)
{ {
Response.ContentType = "text/x-tex"; Response.ContentType = "text/x-tex";
return ViewComponent("Estimate",new object[] { id, false }); return ViewComponent("Estimate",new object[] { id, false });
} }
[HttpGet("gen/{id}")] [HttpPost("gen/{id}")]
public async Task<IActionResult> GeneratePdf(long id) public async Task<IActionResult> GeneratePdf(long id)
{ {
/*
using (TextWriter wr = new StringWriter()) {
ViewComponentContext ctx = new ViewComponentContext(
selector.SelectComponent("Estimate"), new object[]{id},
new ViewContext(),
wr
);
}
*/
return ViewComponent("Estimate",new object[] { id, true } ); return ViewComponent("Estimate",new object[] { id, true } );
} }
} }

Loading…