public IHttpActionResult PostEmployeeReplies(EmployeeReplies employeeReplies) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.EmployeeReplies.Add(employeeReplies); try { db.SaveChanges(); } catch (DbUpdateException) { if (EmployeeRepliesExists(employeeReplies.Comment_ID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = employeeReplies.Comment_ID }, employeeReplies); }
public IHttpActionResult PutEmployeeReplies(int id, EmployeeReplies employeeReplies) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != employeeReplies.Comment_ID) { return BadRequest(); } db.Entry(employeeReplies).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeRepliesExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }