public HttpResponseMessage ValidateBusinessRule(HttpRequestMessage request,
            [FromBody] Reservation reservation)
        {
            //try
            //{
            //ReservationValidator validator = new ReservationValidator();
            //validator.ValidateAndThrow(reservation);

            //    //do something with reservation
            //}
            //catch (FluentValidation.ValidationException ex)
            //{
            //    var result = ex.Errors.Select(item => new System.ComponentModel.DataAnnotations.ValidationResult(item.ErrorMessage, new List<string> { item.PropertyName }));

            //    //foreach (var error in ex.Errors)
            //    //    this.ModelState.AddModelError(error.PropertyName, error.ErrorMessage);

            //    return Request.CreateResponse(HttpStatusCode.BadRequest, result);
            //}

            return GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                ReservationValidator validator = new ReservationValidator();
                validator.ValidateAndThrow(reservation);

                response = request.CreateResponse(HttpStatusCode.OK, reservation);

                return response;
            });
        }
        public HttpResponseMessage ValidateBusinessRule(HttpRequestMessage request,
                                                        [FromBody] Reservation reservation)
        {
            //try
            //{
            //ReservationValidator validator = new ReservationValidator();
            //validator.ValidateAndThrow(reservation);

            //    //do something with reservation
            //}
            //catch (FluentValidation.ValidationException ex)
            //{
            //    var result = ex.Errors.Select(item => new System.ComponentModel.DataAnnotations.ValidationResult(item.ErrorMessage, new List<string> { item.PropertyName }));

            //    //foreach (var error in ex.Errors)
            //    //    this.ModelState.AddModelError(error.PropertyName, error.ErrorMessage);

            //    return Request.CreateResponse(HttpStatusCode.BadRequest, result);
            //}

            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                ReservationValidator validator = new ReservationValidator();
                validator.ValidateAndThrow(reservation);

                response = request.CreateResponse(HttpStatusCode.OK, reservation);

                return response;
            }));
        }
        public void Execute(ReservationDTO request)
        {
            validator.ValidateAndThrow(request);

            _context.Reservation.Add(new Domain.Reservation
            {
                MovieName = request.MovieName
            });
            _context.Tickets.Add(new Domain.Tickets
            {
                TicketPrice = request.Ticket
            });
            _context.SaveChanges();
        }