public async Task <IActionResult> AddSession([FromBody] AddSessionRequest request) { try { var response = await _sessionUseCase.Add(request); return(await ResponseAsync(response)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public AddSessionTest() { _faker = new Faker(); _mediator = new Mock <IMediator>(); _id = Guid.NewGuid(); _repositorySession = SessionRepositoryBuilder.Instance().NotExists().Build(); _command = new AddSessionRequest { SessionStart = _faker.Date.Recent(1), SessionEnd = "01:30", TicketValue = _faker.Finance.Amount(1, 200), Animation = _faker.PickRandom <AnimationType>(), Audio = _faker.PickRandom <AudioType>(), RoomId = Guid.NewGuid(), MovieId = Guid.NewGuid() } ; }
public async Task <Response> Add(AddSessionRequest addSessionRequest) { var responseSession = await _mediator.Send(addSessionRequest, CancellationToken.None); return(responseSession); }
public ActionResult <AddSessionResponse> Add([FromBody] AddSessionRequest request) { request.CommanderID = User.GetUserId(); return(_sessionService.AddSession(request)); }