public async Task <IHttpActionResult> PutEventEmployee(int id, EventEmployee eventEmployee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eventEmployee.EventEmployeeID) { return(BadRequest()); } db.Entry(eventEmployee).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventEmployeeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetEventEmployee(int id) { EventEmployee eventEmployee = await db.EventEmployees.FindAsync(id); if (eventEmployee == null) { return(NotFound()); } return(Ok(eventEmployee)); }
public async Task <IHttpActionResult> PostEventEmployee(EventEmployee eventEmployee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EventEmployees.Add(eventEmployee); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = eventEmployee.EventEmployeeID }, eventEmployee)); }
public async Task <IHttpActionResult> DeleteEventEmployee(int id) { EventEmployee eventEmployee = await db.EventEmployees.FindAsync(id); if (eventEmployee == null) { return(NotFound()); } db.EventEmployees.Remove(eventEmployee); await db.SaveChangesAsync(); return(Ok(eventEmployee)); }
public string AddEmployeeEvent([FromBody] EventEmployee ee) { DBcon.AddEmployeeEvent(conn, ee.eventID, ee.employeeID, "AddEmployeeEvent"); return("Employee " + ee.employeeID + " added to " + ee.eventID); }