public IHttpActionResult PutGoscie(int id, Goscie goscie) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != goscie.Id) { return BadRequest(); } db.Entry(goscie).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GoscieExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostGoscie(Goscie goscie) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Goscies.Add(goscie); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = goscie.Id }, goscie); }