public FillieresModel(Filliers fillier) { this.Id = fillier.Id; this.FilliersId = fillier.FilliersId; this.secteurDactiviteId = fillier.secteurDactiviteId; this.Name = fillier.Name; }
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)); }
public IHttpActionResult GetFilliers(int id) { Filliers filliers = db.Filliers.Find(id); if (filliers == null) { return(NotFound()); } return(Ok(new FillieresModel(filliers))); }
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)); }
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)); }