Ejemplo n.º 1
0
        public ActionResult AddNewDriver(string gender, string state, string name, string license)
        {
            DatabaseInterface db = new DatabaseInterface();
            if (!db.IsDriverLicenseUnique(license))
                return Json("false");

            Driver driver = new Driver()
            {
                Id = ObjectId.GenerateNewId(),
                DriverLicense = license,
                Name = name,
                AssignedTo = -1,
                Gender = gender,
                State = state

            };
            db.SaveDriver(driver);
            return Json("true");
        }
 public void SaveDriver(Driver driver)
 {
     var coll = _database.GetCollection(_driverCollectionName);
     coll.Save(driver);
 }