public IHttpActionResult PostStaffMicroservicesDB(StaffMicroservicesDB staffMicroservicesDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.StaffMicroservicesDBs.Add(staffMicroservicesDB); try { db.SaveChanges(); } catch (DbUpdateException) { if (StaffMicroservicesDBExists(staffMicroservicesDB.ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = staffMicroservicesDB.ID }, staffMicroservicesDB)); }
public IHttpActionResult PutStaffMicroservicesDB(long id, StaffMicroservicesDB staffMicroservicesDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != staffMicroservicesDB.ID) { return(BadRequest()); } db.Entry(staffMicroservicesDB).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!StaffMicroservicesDBExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetStaffMicroservicesDB(long id) { StaffMicroservicesDB staffMicroservicesDB = db.StaffMicroservicesDBs.Find(id); if (staffMicroservicesDB == null) { return(NotFound()); } return(Ok(staffMicroservicesDB)); }
public IHttpActionResult DeleteStaffMicroservicesDB(long id) { StaffMicroservicesDB staffMicroservicesDB = db.StaffMicroservicesDBs.Find(id); if (staffMicroservicesDB == null) { return(NotFound()); } db.StaffMicroservicesDBs.Remove(staffMicroservicesDB); db.SaveChanges(); return(Ok(staffMicroservicesDB)); }