public IHttpActionResult Put(int id, BRelationSize bRelationSize) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bRelationSize.relation_id) { return(BadRequest()); } db.Entry(bRelationSize).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BRelationSizeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Get(int id) { BRelationSize bRelationSize = db.BRelationSizes.Find(id); if (bRelationSize == null) { return(NotFound()); } return(Ok(bRelationSize)); }
public IHttpActionResult Post(BRelationSize bRelationSize) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BRelationSizes.Add(bRelationSize); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = bRelationSize.relation_id }, bRelationSize)); }
public IHttpActionResult Delete(int id) { BRelationSize bRelationSize = db.BRelationSizes.Find(id); if (bRelationSize == null) { return(NotFound()); } db.BRelationSizes.Remove(bRelationSize); db.SaveChanges(); return(Ok(bRelationSize)); }