public IHttpActionResult Putmeterread(int id, meterread meterread)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != meterread.ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult Getmeterread(int id)
        {
            meterread meterread = db.meterreads.Find(id);

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

            return(Ok(meterread));
        }
        public IHttpActionResult Postmeterread(meterread meterread)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.meterreads.Add(meterread);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = meterread.ID }, meterread));
        }
        public IHttpActionResult Deletemeterread(int id)
        {
            meterread meterread = db.meterreads.Find(id);

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

            db.meterreads.Remove(meterread);
            db.SaveChanges();

            return(Ok(meterread));
        }