private byte[] MapSignedContent(BinaryContentResponse bcr) { var args = new ReceiveContentArgs { LastModified = bcr.LastModified, SignedContent = bcr.SignedContent, PublishingId = bcr.PublishingId, }; var argsString = _JsonSerializer.Serialize(args); return(Encoding.UTF8.GetBytes(argsString)); }
public void Execute(HttpContext httpContext) { var e = _Reader.Execute(); var r = new BinaryContentResponse { PublishingId = e.PublishingId, LastModified = e.Release, ContentTypeName = e.ContentTypeName, Content = e.Content }; _Handler.Execute(httpContext, r); }
public IActionResult GetCurrentManifest([FromServices] GetLatestManifestCommand command) { var e = command.Execute(); var r = new BinaryContentResponse { LastModified = e.Release, PublishingId = e.PublishingId, ContentTypeName = e.ContentTypeName, Content = e.Content }; return(new OkObjectResult(r)); }
public async Task <IActionResult> Execute(BinaryContentResponse content) { //TODO check sig!!! if (content == null) { return(new OkResult()); } var e = new T { PublishingId = content.PublishingId, Content = content.Content, ContentTypeName = content.ContentTypeName, SignedContent = content.Content, SignedContentTypeName = MediaTypeNames.Application.Zip, Release = content.LastModified, }; //var config = new StandardEfDbConfig(_Configuration, "Content"); //var builder = new SqlServerDbContextOptionsBuilder(config); //var _DbContext = new ExposureContentDbContext(builder.Build()); try { await _DbContext.Set <T>().AddAsync(e); _DbContext.SaveAndCommit(); } catch (DbUpdateException ex) { if ((ex?.InnerException as SqlException)?.Number == 2601) { return(new ConflictResult()); } throw; } catch (Exception ex) { throw; } return(new OkResult()); }
public async Task <IActionResult> Execute(BinaryContentResponse content) { //TODO check sig!!! if (content == null) { return(new OkResult()); } var e = new T { PublishingId = content.PublishingId, Content = content.Content, ContentTypeName = content.ContentTypeName, SignedContent = content.SignedContent, SignedContentTypeName = MediaTypeNames.Application.Zip, Release = content.LastModified, }; try { await _DbContext.Set <T>().AddAsync(e); _DbContext.SaveAndCommit(); } catch (DbUpdateException ex) { if ((ex?.InnerException as SqlException)?.Number == 2601) { return(new ConflictResult()); } throw; } catch (Exception ex) { throw; } return(new OkResult()); }
public async Task <IActionResult> HttpPostEks([FromBody] BinaryContentResponse args, [FromServices] HttpPostContentReciever <ExposureKeySetContentEntity> command) => await command.Execute(args);
public async Task <IActionResult> HttpPostCalcConfig([FromBody] BinaryContentResponse args, [FromServices] HttpPostContentReciever <RiskCalculationContentEntity> command) => await command.Execute(args);
public async Task <IActionResult> HttpPostResourceBundle([FromBody] BinaryContentResponse args, [FromServices] HttpPostContentReciever <ResourceBundleContentEntity> command) => await command.Execute(args);