public async Task<bool> removeTimesheet(Timesheet timesheet) { try { await _collection.DeleteOneAsync(x => x._id == timesheet._id); return true; } catch (Exception) { return false; } }
public async Task<Timesheet> updateTimesheet(string id, Timesheet timesheet) { try { var x = await _collection.ReplaceOneAsync(t => t._id == new BsonObjectId(new ObjectId(id)), timesheet); return timesheet; } catch (Exception e) { return null; } }
public async Task<bool> addTimesheet(Timesheet timesheet) { try { await _collection.InsertOneAsync(timesheet); return true; } catch (Exception e) { return false; } }