public IHttpActionResult PostAdvice(Advice advice)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Patient patient = db.Patients.Find(advice.PatientId);
            if (patient == null)
            {
                return BadRequest("Patient with id " + advice.PatientId + " does not exist.");
            }

            db.Advices.Add(advice);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new {controller = "advices", id = advice.AdviceId}, advice);
        }
        public IHttpActionResult PutAdvice(int id, Advice advice)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != advice.AdviceId)
            {
                return BadRequest("The AdviceId in the URL and the AdviceId in the data do not match.");
            }

            Patient patient = db.Patients.Find(advice.PatientId);
            if (patient == null)
            {
                return BadRequest("Patient with id " + advice.PatientId + " does not exist.");
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AdviceExists(id))
                {
                    return BadRequest("Advice with id " + id + " does not exist.");
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new {controller = "advices", id = advice.AdviceId}, advice);
        }