public HttpResponseMessage ComprarIngresso(IngressoModel ingresso) { if (ingresso == null) { return(Request.CreateResponse(HttpStatusCode.Unauthorized)); } if (movieDAO.ExisteIngresso(ingresso.IdSessao, ingresso.IdAssento)) { return(Request.CreateResponse(HttpStatusCode.Unauthorized)); } try { movieDAO.ComprarIngresso(ingresso); return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }