// POST: api/Employees public IHttpActionResult PostHotelReservation(HotelReservation hotelReservation) { hotelReservation.CreatedBy = Convert.ToString("0"); hotelReservation.CreationDate = DateTime.Now; //ModelState["hotelReservation.CreatedBy"].Errors.Clear(); if (ModelState.IsValid) { //db.Hotels.Add(hotel); //db.SaveChanges(); _hotelReservationService.InsertHotelReservation(hotelReservation); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, hotelReservation); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = hotelReservation.Id })); return(CreatedAtRoute("DefaultApi", new { id = hotelReservation.Id }, hotelReservation)); } else { return(BadRequest(ModelState)); } }