// GET: Vehicles/Create public IActionResult Create() { ViewData["CompanyId"] = new SelectList(companyRepository.GetAll(), "Id", "Title"); ViewData["VehicleTypeId"] = new SelectList(vehicleTypeRepository.GetAll(), "Id", "Title"); return(View(new VehicleCreateModel() { Vehicles = new List <Vehicle>() { new Vehicle() }, VehicleTypes = new List <VehicleType>() { new VehicleType() } })); }
public IEnumerable <VehicleType> GetAllTypes(ApplicationDbContext dbContext) { // need cache expiration policy implemented across system if (!(MemoryCache.TryGetValue <IEnumerable <VehicleType> >("vehicleTypes", out IEnumerable <VehicleType> vehicleTypes))) { vehicleTypes = VehicleTypeRepository.GetAll(dbContext); MemoryCache.Set <IEnumerable <VehicleType> >("vehicleTypes", vehicleTypes); } return(vehicleTypes); }
public ActionResult Index() { var vehicleTypes = _vehicleTypeRepository.GetAll(); List <VehicleTypeViewModel> VehicleTypeViewModelList = new List <VehicleTypeViewModel>(); foreach (var vehicleType in vehicleTypes) { VehicleTypeViewModelList.Add(new VehicleTypeViewModel(vehicleType)); } return(View(VehicleTypeViewModelList)); }
public ActionResult ChangeDriverDetails() { User user = System.Web.HttpContext.Current.GetOwinContext() .GetUserManager <ApplicationUserManager>() .FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); Driver driver = _driverRepository.GetDriverByUserId(user.Id); Vehicle vehicle = _vehicleRepository.GetVehicleByDriverId(driver.Id); ChangeDriverDetailsViewModel model = new ChangeDriverDetailsViewModel(); model.Id = user.Id; model.UserName = user.UserName; model.Email = user.Email; model.Fullname = user.Fullname; model.DriverId = driver.Id; model.DrivingLicence = driver.DrivingLicence; model.VehicleId = vehicle.Id; model.ModelName = vehicle.ModelName; model.CompanyName = vehicle.CompanyName; model.Color = vehicle.Color; model.RegDate = vehicle.RegDate; model.RegNumber = vehicle.RegNumber; List <SelectListItem> vehicleTypesList = new List <SelectListItem>(); var vehicleTypes = _vehicleTypeRepository.GetAll(); foreach (var vehicleType in vehicleTypes) { vehicleTypesList.Add(new SelectListItem() { Value = vehicleType.Name, Text = vehicleType.Name }); } ViewBag.VehicleTypesList = vehicleTypesList; model.VehicleType = vehicle.VehicleType.Name; return(View(model)); }
public IActionResult Index() { StatusQuery Notification; Notification = new StatusQuery("warning", "", "Vui lòng kiểm tra lại"); ViewBag.Status = Notification.Status; ViewBag.Value = Notification.Value; ViewBag.Type = Notification.Type; var _listVehicle = _vehicletypeRepository.GetAll(); List <VehicleTypeModel> ListVehicleTypeModel = new List <VehicleTypeModel>(); foreach (var item in _listVehicle) { if (item.Id != 0) { var vehicleTypeModel = new VehicleTypeModel() { Active = "Đã kích hoạt", Descreption = item.Descreption, Name = item.Name, Id = item.Id }; ListVehicleTypeModel.Add(vehicleTypeModel); } else { var vehicleTypeModel = new VehicleTypeModel() { Active = "bbbbb", Descreption = item.Descreption, Name = item.Name, Id = item.Id }; ListVehicleTypeModel.Add(vehicleTypeModel); } } return(View(ListVehicleTypeModel)); }
public Task <IActionResult> Get() { return(Response(_repository.GetAll(), new Notification().Notifications)); }
public async Task <IEnumerable <VehicleType> > GetAllVehicleTypes() { return(await _vehicleTypeRepository.GetAll()); }
public IEnumerable <VehicleType> GetAll() { return(_vehicleTypeRepository.GetAll()); }
// GET: VehicleType public ActionResult Index() { return(View(vtRep.GetAll())); }
public IEnumerable <VehicleTypeViewModel> GetAll() { return(Mapper.Map <IEnumerable <VehicleTypeViewModel> >(_vehicleTypeRepository.GetAll())); }
// GET: Passengers public ActionResult Index() { //PassengersViewModel model = new PassengersViewModel(); //User user = System.Web.HttpContext.Current.GetOwinContext() // .GetUserManager<ApplicationUserManager>() // .FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); ////Passenger passenger = _passengerRepository.GetPassengerByUser(user.Id); ////Ride ride = new Ride() ////{ //// Id = model.RideId, //// StartLocation = model.StartLocation, //// EndLocation = model.EndLoaction, //// PassengerId = passenger.Id, //// RideStatus = RideStatus.NotAccepted, ////}; var VehicleTypesList = new List <SelectListItem>(); var vehicleTypes = _vehicleTypeRepository.GetAll(); foreach (var vT in vehicleTypes) { VehicleTypesList.Add(new SelectListItem() { Value = vT.Name, Text = vT.Name }); } ViewBag.VehicleTypes = VehicleTypesList; var PaymentTypesList = new List <SelectListItem>(); var paymentTypes = _paymentTypeRepository.GetAll(); foreach (var pT in paymentTypes) { PaymentTypesList.Add(new SelectListItem() { Value = pT.Name, Text = pT.Name }); } ViewBag.PaymentTypes = PaymentTypesList; User user = System.Web.HttpContext.Current.GetOwinContext() .GetUserManager <ApplicationUserManager>() .FindById(System.Web.HttpContext.Current.User.Identity.GetUserId()); Passenger passenger = _passengerRepository.GetPassengerByUser(user.Id); var ride = _rideRepository.Find(r => r.PassengerId == passenger.Id && (r.RideStatus == RideStatus.OnGoing || r.RideStatus == RideStatus.NotAccepted)).FirstOrDefault(); if (ride != null) { ViewBag.Msg = "Soon some of our best drivers will contact with you. Thank you for using our service."; } return(View(new PassengersViewModel())); }