Example #1
0
 public void CreateDepartment(Department objDept)
 {
     MongoCollection<BsonDocument> departments = mDatabase.GetCollection<BsonDocument>("Departments");
     BsonDocument department = new BsonDocument {
         { "DepartmentName", objDept.DepartmentName },
         { "HeadOfDepartmentId", objDept.HeadOfDepartmentId }
     };
     departments.Insert(department);
 }
Example #2
0
 public ActionResult CreateDepartment(Department objDept)
 {
     try {
         da = new DataAccess();
         da.CreateDepartment(objDept);
         return Json(new { IsDataInserted = true }, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex) {
         return Json(new { IsDataInserted = false, Message = ex.Message }, JsonRequestBehavior.AllowGet);
     }
 }