// Creates a Task and inserts it into the collection in MongoDB. public void CreateTask(Task task) { MongoCollection<Task> collection = GetTasksCollectionForEdit(); try { collection.Insert(task, SafeMode.True); } catch (MongoCommandException ex) { string msg = ex.Message; } }
public ActionResult Create(Task task) { try { dal.CreateTask(task); return RedirectToAction("Index"); } catch { return View(); } }