Exemple #1
0
 public void Create(SolutionCreateCommand Command)
 {
     this.Apply <SolutionCreateEvent>(Command, e =>
     {
         e.Id         = Utils.GenerateId();
         e.CreateTime = DateTime.UtcNow;
     });
 }
Exemple #2
0
        public async Task <Solution> Add()
        {
            var command = new SolutionCreateCommand
            {
                Name = this.GetRandom()
            };
            var message = new HttpRequestMessage(HttpMethod.Post, API);

            message.AddJsonContent(command);
            var responseMessage = await this.HttpClient.SendAsync(message);

            var id = await responseMessage.AsResult <string>();

            var Solution = await this.Get(id);

            Assert.Equal(command.Name, Solution.Name);
            return(Solution);
        }
        public async Task <IActionResult> Post([FromBody] SolutionCreateCommand command)
        {
            var id = await _mediator.Send(command);

            return(await Get(id));
        }
 public async Task <object> Add(SolutionCreateCommand command)
 {
     return(await this._mediator.Send <string>(command));
 }
Exemple #5
0
        public async Task <string> Handle(SolutionCreateCommand command)
        {
            var solution = await this.Add(new Solution(command));

            return(solution.Id);
        }
Exemple #6
0
 public Solution(SolutionCreateCommand command)
 {
 }