// PUT odata/DigitalContainers(5) public IHttpActionResult Put([FromODataUri] long key, DigitalContainer container) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (key != container.Id) { return(BadRequest()); } db.Entry(container).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ContainerExists(key)) { return(NotFound()); } else { throw; } } return(Updated(container)); }
// POST odata/DigitalContainers public IHttpActionResult Post(DigitalContainer container) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Containers.Add(container); db.SaveChanges(); return(Created(container)); }