public async Task <IHttpActionResult> PostBookingModels(BookingRequestDTO bookingRequest) { if (bookingRequest == null) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, "The Booking Request is invalid or otherwise incomplete."))); } var bookingValidator = new BookingValidation(); var errorList = bookingValidator.ValidateBookingRequestDTO(bookingRequest); if (!errorList.All(x => x == true)) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, "The Booking Request is invalid or otherwise incomplete."))); } // kalla på service layer valideringsmetod(bookingRequest); bookingRequest = await bookingServices.AddBookingRequest(bookingRequest); // TO DO returnera fel om en sådan booking redan finns await mailservices.NotifyBookingByMail(bookingRequest); return(CreatedAtRoute("DefaultApi", new { id = bookingRequest.Id }, bookingRequest)); }