public IHttpActionResult Putpublication(decimal id, publication publication) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != publication.Publication_id) { return BadRequest(); } db.Entry(publication).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!publicationExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult Postpublication(publication publication) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.publications.Add(publication); try { db.SaveChanges(); } catch (DbUpdateException) { if (publicationExists(publication.Publication_id)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = publication.Publication_id }, publication); }