public IHttpActionResult PutGoogleMap(int id, GoogleMap googleMap) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != googleMap.Id) { return BadRequest(); } db.Entry(googleMap).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GoogleMapExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostGoogleMap(GoogleMap googleMap) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.GoogleMaps.Add(googleMap); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = googleMap.Id }, googleMap); }