示例#1
0
 public ActionResult Create(MyTask task)
 {
     try
     {
         dal.CreateTask(task);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
示例#2
0
文件: Dal.cs 项目: robotred/DPM-Demo
 // 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;
     }
 }