Example #1
0
        public async Task <IActionResult> Post([FromBody] ScopeCreationDto dto)
        {
            var cmd = new CreateScopeCommand
            {
                ClaimTypes  = dto.ClaimTypes,
                Description = dto.Description,
                DisplayName = dto.DisplayName,
                ScopeName   = dto.ScopeName
            };

            var result = await _sagaBus.InvokeAsync <CreateScopeCommand, ScopeCreationResult>(cmd);

            if (result.Succeed)
            {
                return(Created(Url.Action(nameof(GetById), new { id = result.Id }), null));
            }
            return(StatusCode(412, result.Message));
        }
Example #2
0
 public static Scope ToScope(this CreateScopeCommand command)
 {
     return(command.MapTo <CreateScopeCommand, Scope>());
 }