Example #1
0
        public IHttpActionResult PutApi(int id, Api api)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutChefRedaction(int id, RedacteurEnChef redacteurEnChef)

        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(redacteurEnChef).State = EntityState.Modified;
            db.SaveChanges();


            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public IHttpActionResult PutJournaliste(int id, Journalistes journalistes)

        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(journalistes).State = EntityState.Modified;
            db.SaveChanges();


            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #4
0
        public IHttpActionResult PutArticle(int id, Article article)

        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(article).State = EntityState.Modified;
            db.SaveChanges();


            return(StatusCode(HttpStatusCode.NoContent));
        }