protected async Task <CreateUnitCommand> CreateUnitAsync(HttpClient client)
        {
            var command = new CreateUnitCommand(
                Guid.NewGuid(),
                Random.RandomString(50),
                (await GetLessonListAsync(client)).Random().Id,
                Random.Next(Grade.Min, Grade.Max));

            var response = await client.PostAsync(ApiPath, command.ToJsonContent());

            response.EnsureSuccessStatusCode();

            return(command);
        }
Exemple #2
0
        public async Task <IActionResult> CreateAsync(CreateUnitCommand command)
        {
            await _commandProcessor.SendAsync(command);

            return(Ok());
        }
Exemple #3
0
 public async Task <IActionResult> AddUnitAsync(CreateUnitCommand command)
 {
     return(Ok(await Mediator.Send(command)));
 }