public JsonResult Delete(WijmoEvent ev)
 {
     var y = HttpContext.Request.InputStream;
     y.Position = 0;
     var json = string.Empty;
     using (var reader = new StreamReader(y))
     {
         json = reader.ReadToEnd();
     }
     var repository = new Calendar.Respository.MongoDB.CalendarRepository<CalendarEvent>("CalendarEvents");
     var query = Query.EQ("WijmoEvent._id", ev.id);
     var result = repository.Remove(query);
     if (result != null)
     {
         return Json(new { success = true });
     }
     return Json(new { success = false });
 }
 public JsonResult Add(WijmoEvent ev)
 {
     var y = HttpContext.Request.InputStream;
     y.Position = 0;
     var json = string.Empty;
     using (var reader = new StreamReader(y))
     {
         json = reader.ReadToEnd();
     }
     var repository = new Calendar.Respository.MongoDB.CalendarRepository<CalendarEvent>("CalendarEvents");
     var calendarEvent = new CalendarEvent { WijmoEvent = ev };
     var smr = repository.Insert(calendarEvent);
     if (smr != null)
     {
         return Json(new { success = true });
     }
     return Json(new { success = false });
 }
 public JsonResult Update(WijmoEvent ev)
 {
     //var y = HttpContext.Request.InputStream;
     //y.Position = 0;
     //var json = string.Empty;
     //using (var reader = new StreamReader(y))
     //{
     //    json = reader.ReadToEnd();
     //}
     var repository = new Calendar.Respository.MongoDB.CalendarRepository<CalendarEvent>("CalendarEvents");
     var query = Query.EQ("WijmoEvent._id", ev.id);
     var result = repository.FindOne(query);
     if (result != null)
     {
         result.WijmoEvent = ev;
         repository.Save(result);
         return Json(new { success = true });
     }
     return Json(new { success = false });
 }