public IActionResult Put(string jobId, string id, [FromBody] RuleInModel value) { if (String.IsNullOrEmpty(value.Id)) { return(BadRequest("You have to provide Id with put")); } if (String.IsNullOrEmpty(value.Path)) { return(BadRequest("You have to provide a download path")); } if (String.IsNullOrEmpty(value.Regex)) { return(BadRequest("You have to provide a regex")); } var rule = configurator.GetRule(jobId, id); rule.Regex = value.Regex; rule.Priority = value.Priority; rule.Path = value.Path; configurator.SetRule(jobId, rule); return(Ok(mapper.Map <RuleOutModel>(rule))); }
public IActionResult Post(string jobId, [FromBody] RuleInModel value) { if (!String.IsNullOrEmpty(value.Id)) { return(BadRequest("You cannot provide Id with post")); } if (String.IsNullOrEmpty(value.Path)) { return(BadRequest("You have to provide a download path")); } if (String.IsNullOrEmpty(value.Regex)) { return(BadRequest("You have to provide a regex")); } RuleConfiguration newRule = new RuleConfiguration { Regex = value.Regex, Priority = value.Priority, Path = value.Path }; configurator.SetRule(jobId, newRule); return(Created(Url.Action("Get", new { jobId = jobId, id = newRule.Id }), mapper.Map <RuleOutModel>(newRule))); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='jobId'> /// </param> /// <param name='value'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <RuleOutModel> ApiRulesByIdPutAsync(this ITransmissionApp operations, string id, string jobId = default(string), RuleInModel value = default(RuleInModel), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ApiRulesByIdPutWithHttpMessagesAsync(id, jobId, value, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='jobId'> /// </param> /// <param name='value'> /// </param> public static RuleOutModel ApiRulesByIdPut(this ITransmissionApp operations, string id, string jobId = default(string), RuleInModel value = default(RuleInModel)) { return(operations.ApiRulesByIdPutAsync(id, jobId, value).GetAwaiter().GetResult()); }