public void Create(SolutionCreateCommand Command) { this.Apply <SolutionCreateEvent>(Command, e => { e.Id = Utils.GenerateId(); e.CreateTime = DateTime.UtcNow; }); }
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)); }
public async Task <string> Handle(SolutionCreateCommand command) { var solution = await this.Add(new Solution(command)); return(solution.Id); }
public Solution(SolutionCreateCommand command) { }