// PUT api/Appointment/5
        public HttpResponseMessage PutAppointments(int id, Appointments appointments)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != appointments.Id)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

            db.Entry(appointments).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
        // POST api/Appointment
        public HttpResponseMessage PostAppointments(Appointments appointments)
        {
            int overlap_flag = 0;
            HttpResponseMessage response = new HttpResponseMessage();

            if (ModelState.IsValid)
            {
                foreach(Appointments appointment in db.Appointments)
                {
                    if (appointment.BookDate == appointments.BookDate) {
                        if ((appointment.StartTime <= appointments.StartTime) && (appointment.EndTime >= appointments.StartTime)) {
                            overlap_flag = 1;
                            break;
                        }else if ((appointment.EndTime >= appointments.EndTime) && (appointment.StartTime <= appointments.EndTime))
                        {
                            overlap_flag = 1;
                            break;
                        }
                    } 
                }

                if (overlap_flag == 1)
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, "overlap");
                    response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = appointments.Id }));
                }
                else
                {
                    db.Appointments.Add(appointments);
                    db.SaveChanges();

                    response = Request.CreateResponse(HttpStatusCode.Created, appointments);
                    response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = appointments.Id }));
                }

                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }