예제 #1
0
 public FillieresModel(Filliers fillier)
 {
     this.Id                 = fillier.Id;
     this.FilliersId         = fillier.FilliersId;
     this.secteurDactiviteId = fillier.secteurDactiviteId;
     this.Name               = fillier.Name;
 }
예제 #2
0
        public IHttpActionResult PutFilliers(int id, Filliers filliers)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != filliers.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public IHttpActionResult GetFilliers(int id)
        {
            Filliers filliers = db.Filliers.Find(id);

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

            return(Ok(new FillieresModel(filliers)));
        }
예제 #4
0
        public IHttpActionResult PostFilliers(Filliers filliers)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Filliers.Add(filliers);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = filliers.Id }, filliers));
        }
예제 #5
0
        public IHttpActionResult DeleteFilliers(int id)
        {
            Filliers filliers = db.Filliers.Find(id);

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

            db.Filliers.Remove(filliers);
            db.SaveChanges();

            return(Ok(filliers));
        }