// PUT api/EmployeeAttendance/5 public IHttpActionResult PutEmpAttendanceRegister(int id, EmpAttendanceRegister empattendanceregister) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != empattendanceregister.AttandanceId) { return(BadRequest()); } db.Entry(empattendanceregister).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmpAttendanceRegisterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetEmpAttendanceRegister(int id) { EmpAttendanceRegister empattendanceregister = db.EmpAttendanceRegisters.Find(id); if (empattendanceregister == null) { return(NotFound()); } return(Ok(empattendanceregister)); }
public IHttpActionResult PostEmpAttendanceRegister(EmpAttendanceRegister empattendanceregister) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.EmpAttendanceRegisters.Add(empattendanceregister); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = empattendanceregister.AttandanceId }, empattendanceregister)); }
public IHttpActionResult DeleteEmpAttendanceRegister(int id) { EmpAttendanceRegister empattendanceregister = db.EmpAttendanceRegisters.Find(id); if (empattendanceregister == null) { return(NotFound()); } db.EmpAttendanceRegisters.Remove(empattendanceregister); db.SaveChanges(); return(Ok(empattendanceregister)); }