public async Task <IActionResult> AddClientScope(ClientScopeBindingDto dto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(await _repo.CreateClientScope(_factory.BuildClientScope(dto)))); }
/// <summary> /// Create ClientScope /// </summary> /// <param name="dto"></param> /// <returns>ClientScope</returns> public ClientScope BuildClientScope(ClientScopeBindingDto dto) { //JB. Get juts the client ID (int) var clientId = _ctx.Clients.Where(a => a.ClientId == dto.Client_Id).FirstOrDefault(); var scope = new ClientScope { Scope = dto.Scope, ClientId = clientId.Id }; return(scope); }