public IHttpActionResult PutTags(int id, Tags tags) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != tags.Id) { return BadRequest(); } db.Entry(tags).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TagsExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostTags(Tags tags) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Tags.Add(tags); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = tags.Id }, tags); }