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 }); }