Пример #1
0
 public ActionResult Create(MyTask task)
 {
     try
     {
         dal.CreateTask(task);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
Пример #2
0
 // Creates a Task and inserts it into the collection in MongoDB.
 public void CreateTask(MyTask task)
 {
     var collection = GetTasksCollectionForEdit();
     try
     {
         collection.InsertOne(task);
     }
     catch (MongoCommandException ex)
     {
         string msg = ex.Message;
     }
 }