public async Task <ActionResult <DefaultResponse <bool> > > SaveSecret([FromBody] SaveApiSecretViewModel model) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(Response(false)); } await _apiResourceAppService.SaveSecret(model); return(Response(true)); }
public async Task <ActionResult <IEnumerable <Secret> > > SaveSecret(string resource, [FromBody] SaveApiSecretViewModel model) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(ModelStateErrorResponseError()); } model.ResourceName = resource; await _apiResourceAppService.SaveSecret(model); var secrets = await _apiResourceAppService.GetSecrets(resource); return(ResponsePost(nameof(Secrets), new { resource }, secrets)); }
public Task <bool> SaveSecret(SaveApiSecretViewModel model) { var registerCommand = _mapper.Map <SaveApiSecretCommand>(model); return(Bus.SendCommand(registerCommand)); }
public async Task <ActionResult <IEnumerable <ApiResourceSecret> > > SaveSecret(Guid resource, [FromBody] SaveApiSecretViewModel model) { if (!ModelState.IsValid) { return(BadRequest(new ValidationProblemDetails(ModelState))); } var clients = await _apiResourceRepository.GetAsync(resource); clients.AddSecret(model.Value, model.Expiration, model.Type, model.Description); await _apiResourceRepository.UpdateAsync(clients); return(CreatedAtAction(nameof(Secrets), new { resource }, clients.Secrets)); }