private dynamic InvokePublishing(dynamic o) { var publishRequest = this.Bind <PublishRequest>(); if (!IsAllowedPublishingMode(publishRequest.Mode)) { return(new Response { StatusCode = HttpStatusCode.BadRequest }); } var publishParameters = new PublishParameters { Mode = publishRequest.Mode, Source = publishRequest.Source ?? "master", Targets = publishRequest.Targets.CsvStringToStringArray(new[] { "web" }), Languages = publishRequest.Languages.CsvStringToStringArray(new[] { "en" }), }; var now = DateTime.Now; var date = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); _publishService.Run(publishParameters); return(Response.AsJson(date, HttpStatusCode.Accepted)); }
public async Task WhenFundingIsPublished() { Message message = new Message(); message.UserProperties.Add("user-id", _currentUserStepContext.UserId); message.UserProperties.Add("user-name", _currentUserStepContext.UserName); message.UserProperties.Add("specification-id", _currentSpecificationStepContext.SpecificationId); message.UserProperties.Add("jobId", _currentJobStepContext.JobId); await _publishService.Run(message); }
public override void HandleRequest(HttpContextBase context) { if (CanHandle(context)) { var publishParameters = GetRequest(context.Request); var now = DateTime.Now; var date = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); if (publishParameters.Mode.ToLowerInvariant() == "listofitems") { using (var reader = new StreamReader(context.Request.InputStream)) { var values = reader.ReadToEnd(); if (string.IsNullOrEmpty(values)) { JsonResponse(string.Empty, HttpStatusCode.NoContent, context); } else { var itemsToPublish = Json.Decode <ItemsToPublish>(values); if (itemsToPublish == null) { JsonResponse(string.Empty, HttpStatusCode.BadRequest, context); } else { _publishService.Run(itemsToPublish); var json = Json.Encode(new { date }); JsonResponse(json, HttpStatusCode.Accepted, context); } } } } else { _publishService.Run(publishParameters); var json = Json.Encode(new { date }); JsonResponse(json, HttpStatusCode.Accepted, context); } } else if (Successor != null) { Successor.HandleRequest(context); } }
public override void HandleRequest(HttpContextBase context) { if (CanHandle(context)) { var publishParameters = GetRequest(context.Request); var now = DateTime.Now; var date = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); _publishService.Run(publishParameters); var json = new JavaScriptSerializer().Serialize(new { date }); JsonResponse(json, HttpStatusCode.Accepted, context); } else if (Successor != null) { Successor.HandleRequest(context); } }