POST required to generate the Pdf resource

This commit is contained in:
Paul Schneider 2016-11-10 01:02:57 +01:00
commit 04678995f3

View file

@ -76,36 +76,16 @@ namespace Yavsc.ApiControllers
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]
public IActionResult GetTex(long id)
{
Response.ContentType = "text/x-tex";
return ViewComponent("Estimate",new object[] { id, false });
}
[HttpGet("gen/{id}")]
[HttpPost("gen/{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 } );
}
}