示例#1
0
 // Creates a Note and inserts it into the collection in MongoDB.
 public void CreateNote(Note note)
 {
     IMongoCollection<Note> collection = GetNotesCollectionForEdit();
     try
     {
        collection.InsertOneAsync(note);
     }
     catch (MongoCommandException ex)
     {
         string msg = ex.Message;
     }
 }
 public ActionResult Create(Note note)
 {
     try
     {
         dal.CreateNote(note);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }