// POST: odata/Geographies public IHttpActionResult Post(DimGeography dimGeography) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DimGeographies.Add(dimGeography); db.SaveChanges(); return(Created(dimGeography)); }
// DELETE: odata/Geographies(5) public IHttpActionResult Delete([FromODataUri] int key) { DimGeography dimGeography = db.DimGeographies.Find(key); if (dimGeography == null) { return(NotFound()); } db.DimGeographies.Remove(dimGeography); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/Geographies(5) public IHttpActionResult Put([FromODataUri] int key, Delta <DimGeography> patch) { Validate(patch.GetInstance()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } DimGeography dimGeography = db.DimGeographies.Find(key); if (dimGeography == null) { return(NotFound()); } patch.Put(dimGeography); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DimGeographyExists(key)) { return(NotFound()); } else { throw; } } return(Updated(dimGeography)); }