public void EditLO(LearningObject lo)
 {
     try
     {
         database.GetCollection<LearningObject>("lo").ReplaceOneAsync( a => a.Id == lo.Id ,  lo);
     }
     catch { }
 }
 public void CreateLO(LearningObject lo)
 {
     try
     {
         database.GetCollection<LearningObject>("lo").InsertOneAsync(lo);
     }
     catch { }
 }
 public ActionResult NewLO()
 {
     LearningObject LO = new LearningObject();
     return View(LO);
 }
 public ActionResult NewLO(LearningObject incomingLO)
 {
     if (ModelState.IsValid)
     {
         //return RedirectToAction("MessagePage", new { title = "Succes",  message = "LO succesfully added to DB"});
         try
         {
             db.CreateLO(incomingLO);
             MessageOnPage msg = new MessageOnPage("Succes", "LO succesfully added to DB");
             return RedirectToAction("MessagePage", "Home", msg);
         }
         catch (Exception ex)
         {
             string exceptionMessage = ex.Message;
             string wholeMessage = @"<script language=""javascript"">alert('\n" + "Error during saving to database\n" + exceptionMessage + @"\n')</script>";
             Response.Write(wholeMessage);
         }
     }
     return View(incomingLO);
 }