public IHttpActionResult PutSmartGridInfo(int id, SmartGridInfo smartGridInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != smartGridInfo.SmartGridId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult GetSmartGridInfo(int id)
        {
            SmartGridInfo smartGridInfo = db.SmartGridInfoes.Find(id);

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

            return(Ok(smartGridInfo));
        }
        public IHttpActionResult PostSmartGridInfo(SmartGridInfo smartGridInfo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SmartGridInfoes.Add(smartGridInfo);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = smartGridInfo.SmartGridId }, smartGridInfo));
        }
        public IHttpActionResult DeleteSmartGridInfo(int id)
        {
            SmartGridInfo smartGridInfo = db.SmartGridInfoes.Find(id);

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

            db.SmartGridInfoes.Remove(smartGridInfo);
            db.SaveChanges();

            return(Ok(smartGridInfo));
        }