// PUT api/Rules/5
        public HttpResponseMessage PutRules(int id, Rules rules)
        {
            if (!ModelState.IsValid)
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }

            if (id != rules.Rule_id)
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }

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

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

            return Request.CreateResponse(HttpStatusCode.OK);
        }
        // POST api/Rules
        public HttpResponseMessage PostRules(Rules rules)
        {
            if (ModelState.IsValid)
            {
                db.Rules.Add(rules);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, rules);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = rules.Rule_id }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }