private Workshop CreateWorkshopFromCommand(CreateWorkshopCommand command)
 {
     return(new Workshop
     {
         Description = command.Description,
         Name = command.Name,
         StartDate = command.StartDate,
         EndDate = command.EndDate
     });
 }
Exemple #2
0
        public IActionResult AddWorkshop(CreateWorkshopCommand workshop)
        {
            _mediator.Send(workshop);

            return(Ok());
        }
Exemple #3
0
 /// <inheritdoc/>
 public Task <long> CreateWorkshop(CreateWorkshopCommand command)
 => _repository.CreateWorkshop(command.Adapt <Workshop>());
        protected override async Task <IResponse <CreateWorkshopResult> > HandleAsync(CreateWorkshopCommand command, CancellationToken cancellationToken)
        {
            var workshop = CreateWorkshopFromCommand(command);

            await Context.WorkshopsCommandRepository.AddAsync(workshop);

            await Context.SaveChangesAsync();

            return(Response.Ok(new CreateWorkshopResult(workshop.Id)));
        }
Exemple #5
0
        public async Task <IActionResult> CreateWorkshop(CreateWorkshopCommand command)
        {
            long id = await _workshopService.CreateWorkshop(command);

            return(Created(Url.Link(nameof(GetWorkshop), new { id }), new { Id = id }));
        }