Beispiel #1
0
 public async Task <IActionResult> Add([FromBody] CreateGroupCommand createGroup)
 {
     return(GetResponseOnlyResultMessage(await Mediator.Send(createGroup)));
 }
Beispiel #2
0
        public async Task <IActionResult> Add([FromBody] CreateGroupCommand createGroup)
        {
            var result = await Mediator.Send(createGroup);

            return(result.Success ? Ok(result.Message) : BadRequest(result.Message));
        }
Beispiel #3
0
 public async Task <ActionResult <int> > Create(CreateGroupCommand command)
 {
     return(await Mediator.Send(command));
 }
        public async Task <IActionResult> CreateGroupAsync([FromBody] CreateGroupCommand createGroupCommand)
        {
            var id = await _mediator.Send(createGroupCommand);

            return(Ok(id));
        }
Beispiel #5
0
        public void TestInitialize()
        {
            var factory = AssemblyConfiguration.Kernel.Get <CommandFactory>();

            _sut = factory.GetInstance <CreateGroupCommand>();
        }
Beispiel #6
0
 public GroupTableModel(int groupId, CreateGroupCommand request)
 {
     this.Id   = groupId;
     this.name = request.Name;
     this.link = request.Link;
 }
Beispiel #7
0
        public async Task <IActionResult> Create([FromBody] CreateGroupCommand command)
        {
            var productId = await Mediator.Send(command);

            return(CreatedAtAction("Get", new { id = productId }));
        }
        public async Task <ActionResult <Guid> > CreateGroup(CreateGroupCommand request)
        {
            var result = await Mediator.Send(request);

            return(CreatedAtRoute("GetGroup", new { Id = result }, result));
        }
        public async Task <ActionResult <GroupViewModel> > Create([FromBody] CreateGroupCommand command)
        {
            var vm = await Mediator.Send(command);

            return(Ok(vm));
        }
        public async Task <ActionResult <ResponseWrapper> > CreateGroupAsync([FromBody] CreateGroupCommand command)
        {
            var result = await _mediator.Send(command);

            return(Ok(ResponseWrapper.CreateOkResponseWrapper(result)));
        }
Beispiel #11
0
        public async Task <ActionResult <GroupModel> > CreateGroup([FromBody] CreateGroupCommand command)
        {
            GroupModel newGroup = await Mediator.Send(command);

            return(Ok(newGroup));
        }
Beispiel #12
0
 public AddGroupViewModel()
 {
     Group = new LogGroup();
     CreateGroupCommand = new CreateGroupCommand(this);
     EditGroupCommand   = new EditGroupCommand(this);
 }
Beispiel #13
0
        public async Task <IActionResult> Create([FromBody] CreateGroupCommand command)
        {
            await Mediator.Send(command);

            return(NoContent());
        }
 public static GroupAggregateRoot Register(IWorkContext context, CreateGroupCommand command, DepartmentAggregateRoot department)
 {
     return(new GroupAggregateRoot(command.AggregateId).Create(context, command, department));
 }
Beispiel #15
0
        public async Task <ActionResult <int> > Create([FromBody] CreateGroupCommand command)
        {
            var groupId = await Mediator.Send(command);

            return(Ok(groupId));
        }
Beispiel #16
0
        public GroupMutation()
        {
            Name = "GroupMutation";

            this.FieldAsyncWithScope <StringGraphType, string>(
                "create",
                arguments:
                new QueryArguments
                (
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "name"
            }
                ),
                resolve: async(ctx, mediator) =>
            {
                var command = new CreateGroupCommand()
                {
                    Name = ctx.GetString("name")
                };

                var id = await mediator.Send(command);

                return(id);
            }
                );

            this.FieldAsyncWithScope <BooleanGraphType, bool>(
                "delete",
                arguments:
                new QueryArguments
                (
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "id"
            }
                ),
                resolve: async(ctx, mediator) =>
            {
                var command = new DeleteGroupCommand()
                {
                    Id = ctx.GetString("id")
                };

                await mediator.Send(command);

                return(true);
            }
                );

            this.FieldAsyncWithScope <BooleanGraphType, bool>(
                "update",
                arguments:
                new QueryArguments
                (
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "id"
            },
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "name"
            }
                ),
                resolve: async(ctx, mediator) =>
            {
                var command = new UpdateGroupCommand()
                {
                    Id   = ctx.GetString("id"),
                    Name = ctx.GetString("name")
                };

                await mediator.Send(command);

                return(true);
            }
                );

            this.FieldAsyncWithScope <BooleanGraphType, bool>(
                "addUser",
                arguments:
                new QueryArguments
                (
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "userId"
            },
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "groupId"
            }
                ),
                resolve: async(ctx, mediator) =>
            {
                var command = new AddUserToGroupCommand()
                {
                    UserId  = ctx.GetString("userId"),
                    GroupId = ctx.GetString("groupId")
                };

                await mediator.Send(command);

                return(true);
            }
                );

            this.FieldAsyncWithScope <BooleanGraphType, bool>(
                "removeUser",
                arguments:
                new QueryArguments
                (
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "userId"
            },
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "groupId"
            }
                ),
                resolve: async(ctx, mediator) =>
            {
                var command = new RemoveUserFromGroupCommand()
                {
                    UserId  = ctx.GetString("userId"),
                    GroupId = ctx.GetString("groupId")
                };

                await mediator.Send(command);

                return(true);
            }
                );
        }
Beispiel #17
0
 private void SelectionOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     CreateGroupCommand.RaiseCanExecuteChanged();
     AddToGroupCommand.RaiseCanExecuteChanged();
     UngroupCommand.RaiseCanExecuteChanged();
 }
Beispiel #18
0
 public async Task <IActionResult> Create([FromBody] CreateGroupCommand createGroupCommand)
 => await ExecuteCommand(createGroupCommand);