// PUT api/LinkGroup/5
        public IHttpActionResult PutScriptLinkGroup(int id, ScriptMenu scriptlinkgroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != scriptlinkgroup.ScriptMenuID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetScriptProjectMenu(int id)
        {
            ScriptMenu scriptMenu = db.ScriptMenus.Find(id);

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

            return(Ok(scriptMenu));
        }
        public IHttpActionResult GetScriptLinkGroup(int id)
        {
            ScriptMenu scriptlinkgroup = db.ScriptMenus.Find(id);

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

            return(Ok(scriptlinkgroup));
        }
        public IHttpActionResult PostScriptLinkGroup(ScriptMenu scriptlinkgroup)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ScriptMenus.Add(scriptlinkgroup);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = scriptlinkgroup.ScriptMenuID }, scriptlinkgroup));
        }
        public IHttpActionResult DeleteScriptLinkGroup(int id)
        {
            ScriptMenu scriptlinkgroup = db.ScriptMenus.Find(id);

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

            db.ScriptMenus.Remove(scriptlinkgroup);
            db.SaveChanges();

            return(Ok(scriptlinkgroup));
        }