Exemplo n.º 1
0
        public IHttpActionResult PutDemandeModification(int id, DemandeModification demandeModification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != demandeModification.DemandeModificationId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public IHttpActionResult GetDemandeModification(int id)
        {
            DemandeModification demandeModification = db.DemandeModifications.Find(id);

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

            return(Ok(demandeModification));
        }
Exemplo n.º 3
0
        public IHttpActionResult PostDemandeModification(DemandeModification demandeModification)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DemandeModifications.Add(demandeModification);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = demandeModification.DemandeModificationId }, demandeModification));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeleteDemandeModification(int id)
        {
            DemandeModification demandeModification = db.DemandeModifications.Find(id);

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

            db.DemandeModifications.Remove(demandeModification);
            db.SaveChanges();

            return(Ok(demandeModification));
        }