Ejemplo n.º 1
0
 public async Task<bool> removeTimesheet(Timesheet timesheet)
 {
     try
     {
         await _collection.DeleteOneAsync(x => x._id == timesheet._id);
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Ejemplo n.º 2
0
 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;
     }
 }
Ejemplo n.º 3
0
 public async Task<bool> addTimesheet(Timesheet timesheet)
 {
     try
     {
         await _collection.InsertOneAsync(timesheet);
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }