// GET: Vehicle/Delete/5 public ActionResult Delete(int?id) { if (id != _userManager.findUser(User.Identity.Name).Id) { return(HttpNotFound()); } if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VehicleView vehicles = _vehicleManager.getVehicle(id); if (vehicles == null) { return(HttpNotFound()); } return(View(vehicles)); }
// public async Task<ActionResult> Create([Bind(Include = "Id,Marca,ImagePath,Tipo,Color,Modelo,NoPlacas,NoSerie,Resguardante,Cargo,Adscripcion,NoAvPrevia,NoExpediente,Origen,FechaInicio,FechaFinal")] Vehicle vehicle) public async Task <ActionResult> Create(VehicleView view) { var pic = string.Empty; var folder = "~/Content/Vehicles"; if (view.ImageFile != null) { pic = FilesHelper.UploadPhoto(view.ImageFile, folder); pic = $"{ folder}/{ pic}"; } var vehicle = this.ToVehicle(view, pic); db.Vehicles.Add(vehicle); await db.SaveChangesAsync(); return(RedirectToAction("Index")); return(View(view)); }
static void Main(string[] args) { Vehicle vehicle = new Vehicle { Description = "Vehiculo economico", Price = 5000.0 }; VehicleView vehicleView = new VehicleView(vehicle); vehicleView.ReDraw(); vehicle.Price = 4500.0; VehicleView vehicleView2 = new VehicleView(vehicle); vehicle.Price = 5500.0; Console.ReadKey(); }
//public async Task<ActionResult> Edit([Bind(Include = "Id,Marca,ImagePath,Tipo,Color,Modelo,NoPlacas,NoSerie,Resguardante,Cargo,Adscripcion,NoAvPrevia,NoExpediente,Origen,FechaInicio,FechaFinal")] Vehicle vehicle) public async Task <ActionResult> Edit(VehicleView view) { if (ModelState.IsValid) { var pic = view.ImagePath; var folder = "~/Content/Vehicles"; if (view.ImageFile != null) { pic = FilesHelper.UploadPhoto(view.ImageFile, folder); pic = $"{ folder}/{ pic}"; } var vehicle = this.ToVehicle(view, pic); db.Entry(vehicle).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(view)); }
private Vehicle ToVehicle(VehicleView view, string pic) { return(new Vehicle { Id = view.Id, Marca = view.Marca, Tipo = view.Tipo, Color = view.Color, Modelo = view.Modelo, NoPlacas = view.NoPlacas, NoSerie = view.NoSerie, Resguardante = view.Resguardante, Cargo = view.Cargo, Adscripcion = view.Adscripcion, NoAvPrevia = view.NoAvPrevia, NoExpediente = view.NoExpediente, Origen = view.Origen, FechaInicio = view.FechaInicio, FechaFinal = view.FechaFinal, ImagePath = pic, }); }
public ActionResult Edit([Bind(Include = "Id,CustomerId,LicensePlate,ChassisNo,RegistrationDate,Make,Model")] VehicleView vehicles) { UserView u = _userManager.findUser(User.Identity.Name); if (u != null) { if (vehicles.CustomerId != u.Id) { return(HttpNotFound()); } if (ModelState.IsValid) { _vehicleManager.updateVehicle(vehicles); return(RedirectToAction("Index")); } return(View(vehicles)); } else { return(HttpNotFound()); } }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BookingView bookings = _bookingManager.GetBooking(id); UserView user = _userManager.findUserById(bookings.UserId); ViewBag.UserEmail = user.Email; VehicleView vehicle = _VehicleManager.getVehicle(bookings.VehicleId); ViewBag.LicensePlate = vehicle.LicensePlate; ServiceView service = _serviceManager.GetService(bookings.ServiceId); ViewBag.ServiceName = service.ServiceName; if (bookings == null) { return(HttpNotFound()); } return(View(bookings)); }
private void SelectNode(object sender, TreeViewEventArgs e) { string name = treeView.SelectedNode.Text; switch (name) { case "Quản lý nhân viên": var userView = new UserView { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(userView); break; case "Quản lý cấu hình hệ thống": var configurationView = new ConfigurationView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(configurationView); break; case "Quản lý nội dung tin nhắn": var smsView = new SmsView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(smsView); break; case "Quản lý nội dung email": var emailView = new EmailView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(emailView); break; case "Quản lý khách hàng": var customerView = new CustomerView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(customerView); break; case "Quản lý loại sản phẩm": var productTypeView = new ProductTypeView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(productTypeView); break; case "Quản lý sản phẩm": var productView = new ProductView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(productView); break; case "Quản lý sản phẩm LD": var productLDView = new ProductLDView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(productLDView); break; case "Quản lý thiết bị vận chuyển": var vehicleView = new VehicleView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(vehicleView); break; case "Quản lý đơn hàng": var orderView = new OrderView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(orderView); break; case "Quản lý thông tin vận chuyển": var mainView = new MainView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(mainView); break; case "Bảng thông tin đơn hàng": var frm = new DashboardForm { Dock = DockStyle.Fill, TopLevel = true }; frm.ShowDialog(); break; case "Quản lý tên thành phố": var cityView = new CityView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(cityView); break; case "Quản lý quyền truy cập": var roleView = new RoleView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(roleView); break; case "Quản lý cập nhật dữ liệu": var lockingView = new LockingView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(lockingView); break; case "Quản lý thông tin email": var emailDataView = new EmailDataView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(emailDataView); break; case "Quản lý thông tin tin nhắn": var smsDataView = new SmsDataView(CurrentUser) { Dock = DockStyle.Fill, TopLevel = false }; OpenForm(smsDataView); break; default: break; } }
public void updateVehicle(VehicleView vehicles) { _vehicleRepository.updateVehicle(vehicles); }
public void addVehicle(string name, VehicleView vehicles) { _vehicleRepository.addVehicle(name, vehicles); }
public List <CarView> AllCarSearch(InventorySearchParameters parameters) { var list = new List <CarView>(); var dbList = _ctx.Cars.ToList(); dbList = dbList.Where(c => c.IsPurchased == false).ToList(); if (string.IsNullOrEmpty(parameters.SearchTerm) && parameters.MaxPrice == null && parameters.MinPrice == null && parameters.MaxYear == null && parameters.MinYear == null && parameters.SearchTerm == null) { dbList = dbList.OrderByDescending(c => c.MSRP).ToList(); } else { if (!string.IsNullOrEmpty(parameters.SearchTerm) && parameters.SearchTerm.Length > 2) { if (parameters.SearchTerm.Contains(" ")) { var secondTerm = ""; var thirdTerm = ""; var splitTerm = parameters.SearchTerm.Split(' '); var firstTerm = splitTerm[0]; if (splitTerm[1].Length > 0) { secondTerm = splitTerm[1]; if (splitTerm.Length > 2) { thirdTerm = splitTerm[2]; } } if (firstTerm != null) { dbList = dbList.Where(c => c.Year.ToString().Contains(firstTerm) || c.CarMake.MakeName.ToUpper().Contains(firstTerm.ToUpper()) || c.CarModel.ModelName.ToUpper().Contains(firstTerm.ToUpper())).ToList(); } if (secondTerm != null) { dbList = dbList.Where(c => c.Year.ToString().Contains(secondTerm) || c.CarMake.MakeName.ToUpper().Contains(secondTerm.ToUpper()) || c.CarModel.ModelName.ToUpper().Contains(secondTerm.ToUpper())).ToList(); } if (thirdTerm != null) { dbList = dbList.Where(c => c.Year.ToString().Contains(secondTerm) || c.CarMake.MakeName.ToUpper().Contains(secondTerm.ToUpper()) || c.CarModel.ModelName.ToUpper().Contains(secondTerm.ToUpper())).ToList(); } } } if (!string.IsNullOrEmpty(parameters.SearchTerm) && !parameters.SearchTerm.Contains(" ")) { dbList = dbList.Where(c => c.Year.ToString().Contains(parameters.SearchTerm.ToUpper()) || c.CarMake.MakeName.ToUpper().Contains(parameters.SearchTerm.ToUpper()) || c.CarModel.ModelName.ToUpper().Contains(parameters.SearchTerm.ToUpper())).ToList(); if (dbList.Count() == 0) { return(list); } else { } } if (parameters.MaxPrice != null) { dbList = dbList.Where(c => c.SalePrice < parameters.MaxPrice).ToList(); } if (parameters.MinPrice != null) { dbList = dbList.Where(c => c.SalePrice > parameters.MinPrice).ToList(); } if (parameters.MaxYear != null) { dbList = dbList.Where(c => c.Year <= parameters.MaxYear).ToList(); } if (parameters.MinYear != null) { dbList = dbList.Where(c => c.Year >= parameters.MinYear).ToList(); } } dbList = dbList.Take(20).ToList(); foreach (var car in dbList) { list.Add(VehicleView.Car(car)); } return(list); }
public override void Enter(params object[] args) { _screen = new RenderTarget2D(StateMachine.Game.GraphicsDevice, 224, 256); _spriteBatch = new SpriteBatch(StateMachine.Game.GraphicsDevice); var resetForNewGame = true; if (args.Length > 0 && args[0] is bool) { resetForNewGame = (bool)args[0]; } if (resetForNewGame) { _playerModel = new PlayerModel(); } else { _playerModel.ResetAfterLevel(); } var goals = new GoalContainerModel(); _views.Add(new BackgroundView(StateMachine.Game.Content, _spriteBatch)); _views.Add(new ScoreView(StateMachine.Game.Content, _spriteBatch, _playerModel)); _views.Add(new FrogPositionView(StateMachine.Game.Content, _spriteBatch, _playerModel)); _views.Add(new GoalView(StateMachine.Game.Content, _spriteBatch, goals)); var playerController = new PlayerController(_playerModel); _controllers.Add(playerController); _controllers.Add(new GoalController(_playerModel, goals, playerController)); _controllers.Add(new HomeAnimationController(goals)); var bulldozerRowModel = new VehicleRowModel(BulldozerFactory.CreateFirstStage(), 32); var racingCarRowModel = new VehicleRowModel(RacingCarFactory.CreateFirstStage(), 0, 128, VehicleGhost.NoGhost, VehicleDirection.LeftToRight, 2); var sedanCarRowModel = new VehicleRowModel(GenericCarFactory.CreateFirstStage(), 0, 32, VehicleGhost.Ghost, VehicleDirection.RightToLeft); var duneBuggyRowModel = new VehicleRowModel(GenericCarFactory.CreateFirstStage(y: 208, frame: 9), 0, 32, VehicleGhost.Ghost, VehicleDirection.RightToLeft); var trucksRowModel = new VehicleRowModel(TruckFactory.CreateFirstStage(), 0, 36, VehicleGhost.Ghost, VehicleDirection.RightToLeft); var models = new[] { bulldozerRowModel, racingCarRowModel, sedanCarRowModel, duneBuggyRowModel, trucksRowModel }; var vehicleView = new VehicleView(StateMachine.Game.Content, _spriteBatch, models); _views.Add(vehicleView); var vehicleController = new VehicleController(_playerModel, playerController, models); _controllers.Add(vehicleController); var riverRow1 = new RiverRowModel(LogFactory.CreateRow1FirstStage(), 0, 36, VehicleDirection.LeftToRight, new Rectangle(0, 48, 216, 16)); var riverRow2 = new RiverRowModel(LogFactory.CreateRow2FirstStage(), 0, 36, VehicleDirection.RightToLeft, new Rectangle(0, 64, 216, 16)); var riverRow3 = new RiverRowModel(LogFactory.CreateRow3FirstStage(), 64, 36, VehicleDirection.LeftToRight, new Rectangle(0, 80, 216, 16)); var riverRow4 = new RiverRowModel(LogFactory.CreateRow4FirstStage(), 0, 36, VehicleDirection.RightToLeft, new Rectangle(0, 96, 216, 16)); var riverRow5 = new RiverRowModel(LogFactory.CreateRow5FirstStage(), 32, 36, VehicleDirection.LeftToRight, new Rectangle(0, 112, 216, 16)); var riverModels = new[] { riverRow1, riverRow2, riverRow3, riverRow4, riverRow5 }; var riverView = new VehicleView(StateMachine.Game.Content, _spriteBatch, riverModels); _views.Add(riverView); var riverController = new RiverObjectController(_playerModel, playerController, riverModels); _controllers.Add(riverController); _views.Add(new PlayerView(StateMachine.Game.Content, _spriteBatch, _playerModel)); }
/// <summary> /// Switches the view between master/detail /// </summary> /// <param name="view">Enum value of the view</param> private void ShowView(VehicleView view) { switch (view) { case VehicleView.Grid: // Show grid gvVehicles.Visible = true; Button1.Visible = true; // Refresh grid this.RefreshGrid(); // Hide details ucVehicleInfo.Visible = false; break; case VehicleView.Details: // Hide grid gvVehicles.Visible = false; // Show details Button1.Visible = false; ucVehicleInfo.Visible = true; break; } }