public IActionResult BuyTickets([FromBody] TicketRequest ticketRequest) { if (ticketRequest == null) { return(StatusCode(400, ModelState)); } if (!ModelState.IsValid) { return(StatusCode(400, ModelState)); } var username = Constants.GetUsername(Request); try { var tickets = ticketRepository.BuyTickets(username, ticketRequest); return(Ok(tickets)); } catch (Exception e) { throw e; } }