public IActionResult BookTicket([FromBody] Ticket ticket) { var ticket1 = _ticketRepository.BookTicket(ticket.MovieName, ticket.Date); if (ticket1 == null) { return(BadRequest()); } return(Ok(ticket1)); }
public IActionResult Post([FromBody] TicketDetails value) { try { var GenerateTicket = ticketRepository.BookTicket(value); if (GenerateTicket == null) { return(NotFound("Error")); } return(Ok(GenerateTicket)); } catch (Exception) { return(BadRequest("Link Failure")); } }
public async Task <TicketViewModel> BookTicket(Guid showId, Guid userId) { try { var show = await _showRepository.GetById(showId); if (show.Tickets.Count >= show.TicketCount) { return(null); } return(await _ticketRepository.BookTicket(show, userId)); } catch (Exception ex) { _logger.LogError(ex.Message); return(null); } }