public async Task <ActionResult <RoleMetadata> > Create([FromBody] RoleMetadata data) { try { IRoleProvider res = await _workspace.Roles.Create(data); return(Created($"users/{res.Id}", await res.GetMetadata())); } catch { return(Forbid()); } }
public async Task <ActionResult <RoleMetadata> > GetByName(string name) { IRoleProvider res = await _workspace.Roles.GetByName(name); if (res != null) { return(Ok(await res.GetMetadata())); } else { return(NotFound()); } }