public IHttpActionResult PutInfusionPreference(int id, InfusionPreference infusionPreference)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != infusionPreference.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InfusionPreferenceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        //public IHttpActionResult Create([ModelBinder(typeof(GlobalPreferencesModelBinder))]InfusionPreference value)
        public IHttpActionResult Create(InfusionPreference value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                service.Create(value);
                return(CreatedAtRoute("Providers_Create", new { id = value.Id }, value));
            }
            catch (NotSupportedException)
            {
                return(BadRequest());
            }
            catch (UnauthorizedAccessException)
            {
                return(StatusCode(HttpStatusCode.Forbidden));
            }
            catch (KeyNotFoundException)
            {
                return(NotFound());
            }
        }
        public IHttpActionResult GetInfusionPreference(int id)
        {
            InfusionPreference infusionPreference = db.InfusionPreferences.Find(id);

            if (infusionPreference == null)
            {
                return(NotFound());
            }

            return(Ok(infusionPreference));
        }
        public IHttpActionResult PostInfusionPreference(InfusionPreference infusionPreference)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.InfusionPreferences.Add(infusionPreference);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = infusionPreference.Id }, infusionPreference));
        }
        public IHttpActionResult DeleteInfusionPreference(int id)
        {
            InfusionPreference infusionPreference = db.InfusionPreferences.Find(id);

            if (infusionPreference == null)
            {
                return(NotFound());
            }

            db.InfusionPreferences.Remove(infusionPreference);
            db.SaveChanges();

            return(Ok(infusionPreference));
        }