// // Update a message // public UpdateResponseMessage updateMessage(String id, UpdateRequestMessage req) { UpdateResponseMessage response; ObjectId oid = new ObjectId(id); try { var filter = new BsonDocument("_id", oid); var update = Builders <BsonDocument> .Update .Set("from", req.from) .Set("to", req.to) .Set("date", req.date) .Set("message", req.message); BsonDocument result = col.FindOneAndUpdate(filter, update); response = new UpdateResponseMessage(Status.STATUS.SUCCESS, id, req, result); } catch (MongoWriteException err) { response = new UpdateResponseMessage(Status.STATUS.ERROR, id, req, err); } return(response); }
// // Update a message // public UpdateResponseMessage updateMessage(String id, UpdateRequestMessage req) { UpdateResponseMessage response = messageDao.updateMessage(id, req); return(response); }