public async Task <IActionResult> CreateWorkshop(CreateWorkshopRequest createWorkshopRequest) // command { var command = Mapper.Map <CreateWorkshopCommand>(createWorkshopRequest); var response = await Mediator.Send(command); return(BuildHttpResponse <CreateWorkshopResult, CreateWorkshopResponse>(response)); }
public async Task <IActionResult> PostWorkshop([FromBody] CreateWorkshopRequest request) { var name = _userManager.GetUserId(User); var user = await _userManager.FindByEmailAsync(name); return(Ok(await _service.Create( new Workshop { ChoreographerId = request.ChoreographerId, Category = request.Category, Style = request.Style, Price = request.Price, PlaceId = request.PlaceId, Date = request.Date, Time = request.Time, MaxUsers = request.MaxUsers, MinAge = request.MinAge, CreatedBy = user.Id, IsApprovedByModerator = false, Photo = PreparePhoto(request.Photo), PhotoName = request.PhotoName }))); }