public ActionResult ViewBus(string id)
 {
     DatabaseInterface db = new DatabaseInterface();
      Bus bus = db.GetBusById(new ObjectId(id));
      if (bus == null)
      {
     return Json(new { error = "true" });
      }
      return PartialView("ViewBusView", new ViewBusModel()
      {
     LicensePlate = bus.LicensePlate,
     State = bus.State,
     Capacity = bus.Capacity,
     Status = bus.Status == BusStatus.Active ? "Active" : "Inactive",
     BusId = bus.BusId,
     RouteName = bus.AssignedTo == -1 ? "" : db.GetRouteByRouteId(bus.AssignedTo).Name
      });
 }
 public ActionResult ModifyRoute(String routeId)
 {
     DatabaseInterface db = new DatabaseInterface();
     Route route = db.GetRouteByRouteId(int.Parse(routeId));
     AddRouteModel model = new AddRouteModel()
     {
         AvailableBuses = db.GetAvailableBuses(),
         AvailableStops = db.GetAvailableStops(),
         AvailableDrivers = db.GetAvailableDrivers(),
         Bus = route.Bus,
         Driver = route.Driver,
         Name = route.Name,
         RouteId = routeId,
         Stops = route.Stops,
         UpdatingRoute = true
     };
     return PartialView("AddRoute", model);
 }
        public ActionResult AddNewEmployee(bool isMale, string email, string phone, string address, string city, string state, int routeId, long ssn, string position, string name)
        {
            DatabaseInterface db = new DatabaseInterface();
            if (!db.IsSocialSecurityNumberUnique(ssn))
                return Json("false");

            Employee employee = new Employee()
            {
                Id = ObjectId.GenerateNewId(),
                SocialSecurityNumber = ssn,
                Position = position,
                Name = name,
                IsMale = isMale,
                Email = email,
                Phone = phone,
                Address = address,
                City = city,
                State = state,
                route = db.GetRouteByRouteId(routeId),
                EmployeeId = db.GetNextEmployeeId()

            };
            db.SaveEmployee(employee);
            return Json("true");
        }