private Models.TicketUsed TransformDaoToBusinessLogicTicketUsed(TicketUsedDao ticketUsed) { var ticketPurchase = _ticketPurchase.GetTicketPurchaseById(ticketUsed.TicketPurchaseId); var ticket = ticketPurchase.Ticket; return(new Models.TicketUsed() { Id = ticketUsed.Id, Ticket = ticket, Time = ticketUsed.Time }); }
public ActionResult <Models.TicketPurchase> GetTicketPurchaseById(int ticketPurchaseId) { try { return(Ok(new OkResponse <Models.TicketPurchase>(_ticketPurchase.GetTicketPurchaseById(ticketPurchaseId)))); } catch (TicketPurchaseNotFoundException e) { return(NotFound(e.Message)); } catch (Exception e) { return(BadRequest(new ErrorResponse(e.Message, new List <string>() { "ticketPurchaseId" }))); } }