Пример #1
0
        public async override Task <Guid> Execute(PermissionCreateCommand input, User?user)
        {
            var p = new Permission(input.Action, input.Scope);

            await spec.CheckAndThrow(p);

            await repo.Add(p);

            return(p.Id);
        }
Пример #2
0
        public async override Task Execute(PermissionUpdateCommand input, User?user)
        {
            var p = await repo.FindById(input.Id) ?? throw new EntityNotFoundException();

            p.Action = input.Action;
            p.Scope  = input.Scope;

            await spec.CheckAndThrow(p);

            await repo.Update(p);
        }