public IHttpActionResult PutLeave_Type(int id, Leave_Type leave_Type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != leave_Type.ID) { return(BadRequest()); } db.Entry(leave_Type).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Leave_TypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostLeave_Type(Leave_Type leave_Type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Leave_Type.Add(leave_Type); try { db.SaveChanges(); } catch (DbUpdateException) { if (Leave_TypeExists(leave_Type.ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = leave_Type.ID }, leave_Type)); }
public IHttpActionResult GetLeave_Type(int id) { Leave_Type leave_Type = db.Leave_Type.Find(id); if (leave_Type == null) { return(NotFound()); } return(Ok(leave_Type)); }
public IHttpActionResult DeleteLeave_Type(int id) { Leave_Type leave_Type = db.Leave_Type.Find(id); if (leave_Type == null) { return(NotFound()); } db.Leave_Type.Remove(leave_Type); db.SaveChanges(); return(Ok(leave_Type)); }
public bool Update(Leave_Type entity) { _db.Leave_Types.Update(entity); return(save()); }
public bool Delete(Leave_Type entity) { _db.Leave_Types.Remove(entity); return(save()); }
public bool create(Leave_Type entity) { _db.Leave_Types.Add(entity); return(save()); }