public CarFacade()
 {
 model = new CarModel();
 engine = new CarEngine();
 body = new CarBody();
 accessories = new CarAccessories();
 }
Exemple #2
0
        public void Demonstrate()
        {
            var CarModels = new CarModel();
            CarModels.SetModel("Bmw");
            CarModels.SetWheels("4");

            var newObject = CarModels.Buid();

            Console.WriteLine($"the new car model {newObject.Model}");
        }
Exemple #3
0
 public void SetCar(int carId, CarModel carModel, (string firstName, string surname) name)
Exemple #4
0
 /// <inheritdoc />
 public override void Add(CarModel cm)
 {
     cm.Engine = this;
 }
Exemple #5
0
        public async Task <bool> Create(CarModel car)
        {
            await _context.Cars.AddAsync(car);

            return(await _context.SaveChangesAsync() > 0);
        }
Exemple #6
0
 public CarCreationPage SetFeaturedFrom(CarModel car)
 {
     FeaturedFromDateField.SendKeys(car.Setting.FeaturedFrom.ToShortDateString());
     return(new CarCreationPage());
 }
 public void DisplayScreen(CarModel model)
 {
     GridPrincipal.Children.Add(new Display(this, model));
 }
 public void FinancialScreen(CarModel model)
 {
     //GridPrincipal.Children.Clear();
     GridPrincipal.Children.Add(new FinancialDetails(this, model));
 }
 public OrderViewModel(OrderModel o)
 {
     order  = o;
     car    = o.Car;
     client = o.Client;
 }
Exemple #10
0
 private void TypeCarDescription(CarModel car)
 {
     SwitchToFrame(CarDescriptionFrame);
     CarDescriptionField.SendKeys(car.CarDescription);
     SwitchToDefaultContent();
 }
Exemple #11
0
 private void TypeCarName(CarModel car) => CarNameField.SendKeys(car.CarName);
Exemple #12
0
 public Car(CarModel model, CarColor clr, string reg, Owner owner)
     : this(model, clr, reg)
 {
     this.owner = new Owner(owner);
 }
Exemple #13
0
 public Car(CarModel model, CarColor clr, string reg)
 {
     this.color = clr;
     this.model = model;
     this.regNumber = reg;
 }
    protected void OnRunReferenceItemDialog(object sender, Reference.RunReferenceItemDlgEventArgs e)
    {
        ResponseType Result;
        switch (e.TableName)
        {
            case "models":
                CarModel ItemModel = new CarModel();
                if(e.NewItem)
                    ItemModel.NewItem = true;
                else
                    ItemModel.Fill(e.ItemId);
                ItemModel.Show();
                Result = (ResponseType)ItemModel.Run();
                ItemModel.Destroy();
                break;
            case "status":
                Status StatusEdit = new Status();
                if(e.NewItem)
                    StatusEdit.NewItem = true;
                else
                    StatusEdit.Fill(e.ItemId);
                StatusEdit.Show();
                Result = (ResponseType)StatusEdit.Run();
                StatusEdit.Destroy();
                break;
            case "services":
                Service ServiceEdit = new Service();
                if(e.NewItem)
                    ServiceEdit.NewItem = true;
                else
                    ServiceEdit.Fill(e.ItemId);
                ServiceEdit.Show();
                Result = (ResponseType)ServiceEdit.Run();
                ServiceEdit.Destroy();
                break;
            case "stocks":
                OrderStock StocksEdit = new OrderStock();
                if(e.NewItem)
                    StocksEdit.NewItem = true;
                else
                    StocksEdit.Fill(e.ItemId);
                StocksEdit.Show();
                Result = (ResponseType)StocksEdit.Run();
                StocksEdit.Destroy();
                break;

            default:
                Result = ResponseType.None;
                break;
        }
        e.Result = Result;
    }
Exemple #15
0
 public int UpdateCar(CarModel car)
 {
     throw new NotImplementedException();
 }
        public void UpdateCar(CarModel carModel)
        {
            var car = DALObjectCreator.carObject(carModel);

            carModelRepo.Update(car);
        }
Exemple #17
0
 public OrderViewModel()
 {
     order  = new OrderModel();
     client = new ClientModel();
     car    = new CarModel();
 }
 public void CoApplicantForm(CarModel model)
 {
     //GridPrincipal.Children.Clear();
     GridPrincipal.Children.Add(new CoApplicantForm(this, model));
 }
 public CarManual(CarModel model, byte[] manualPDF)
 {
     Model        = model;
     CarManualPDF = manualPDF;
 }
 public void PreviewScreen(CarModel model)
 {
     GridPrincipal.Children.Add(new Preview(this, model));
 }
 public Car[] GetCarsByModel(CarModel model)
 {
     return(provider.GetCarsByModel(model).ToArray());
 }
        public async Task <Object> AddCar(CarModel carModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var rentACarService = await _context.RentACarServices
                                  .Include(cars => cars.RACServiceCars)
                                  .Include(ocene => ocene.RACOcene)
                                  .Include(address => address.RACBranches)
                                  .Include(comments => comments.RACComments)
                                  .FirstOrDefaultAsync(i => i.idRAC == carModel.idService);

            if (rentACarService == null)
            {
                return(BadRequest());
            }



            Car car = new Car();

            car.Model = carModel.Model;
            car.Brand = ReturnBrand(carModel.Brand);
            car.Type  = ReturnType(carModel.Type);
            car.Gear  = ReturnGear(carModel.Gear);
            car.Fuel  = ReturnFuel(carModel.Fuel);
            car.Doors = ReturnDoor(carModel.Doors);
            car.Seats = ReturnSeat(carModel.Seats);
            car.Year  = new DateTime(Int32.Parse(carModel.Year));
            car.Kw    = Int32.Parse(carModel.Kw);
            double d = car.Kw * 1.56;

            car.Cm3 = Int32.Parse(Math.Ceiling(d).ToString());
            if (car.Seats == SeatsCarEnum.Two)
            {
                car.FreeSeats = 2;
            }
            else if (car.Seats == SeatsCarEnum.Four)
            {
                car.FreeSeats = 4;
            }
            else if (car.Seats == SeatsCarEnum.Five)
            {
                car.FreeSeats = 5;
            }
            else if (car.Seats == SeatsCarEnum.Six)
            {
                car.FreeSeats = 6;
            }
            else
            {
                car.FreeSeats = 7;
            }
            car.Trunk       = Int32.Parse(carModel.Trunk);
            car.PricePerDay = Double.Parse(carModel.Price);
            car.CarImage    = carModel.CarImg;
            car.BabySeat    = StringToBool(carModel.BabySeat);
            car.Navigation  = StringToBool(carModel.Navigation);
            car.RoofRack    = StringToBool(carModel.RoofRack);
            car.deleted     = false;


            //_context.Cars.Add(car);
            rentACarService.RACServiceCars.Add(car);

            try
            {
                await _context.SaveChangesAsync();
            }
#pragma warning disable CS0168 // The variable 'e' is declared but never used
            catch (Exception e)
#pragma warning restore CS0168 // The variable 'e' is declared but never used
            {
                throw;
            }

            //var cars = await _context.Cars.Where(x => x.deleted == false)
            //    .Include(ocene => ocene.OceneAuta)
            //    .Include(rezervacije => rezervacije.RezervacijeAutaOdDo)
            //    .ToListAsync();

            return(car);

#pragma warning disable CS0162 // Unreachable code detected
            string message = "Uspesno";
#pragma warning restore CS0162 // Unreachable code detected
            return(Ok(new { message }));

            //return CreatedAtAction("GetFlight", new { id = flight.id }, flight);
            return(BadRequest());
        }
        private async void AddCar()
        {
            CarModel car = new CarModel();

            car.Brand         = CarBrand;
            car.Model         = CarModelo;
            car.Colour        = CarColour;
            car.Transmision   = CarTransmision;
            car.Year          = CarYear;
            car.Miles         = CarMiles;
            car.Type          = CarType;
            car.Price         = CarPrice;
            car.DoorsQuantity = CarDoorsQuantity;
            car.Capacity      = CarCapacity;
            car.Motor         = CarMotor;
            car.Gas           = CarGas;

            car.ElectricWindows   = CarElectricWindows;
            car.CentralLock       = CarCentralLock;
            car.HydraulicSteering = CarHydraulicSteering;
            car.ElectricRearView  = CarElectricRearView;
            car.Alarm             = CarAlarm;
            car.AirConditioner    = CarAirConditioner;
            car.LuxuryHoops       = CarLuxuryHoops;
            car.lstImagenes       = lstImages;

            string saved = "";

            saved = await CarModel.SaveCar(car);

            if (Int32.Parse(saved) > 0)
            {
                lstImages            = new ObservableCollection <ImageFile>();
                CarBrand             = "";
                CarModelo            = "";
                CarColour            = "";
                CarTransmision       = "";
                CarYear              = 0;
                CarMiles             = 0;
                CarType              = "";
                CarPrice             = 0;
                CarDoorsQuantity     = 0;
                CarCapacity          = 0;
                CarMotor             = "";
                CarGas               = "";
                CarElectricWindows   = false;
                CarCentralLock       = false;
                CarHydraulicSteering = false;
                CarElectricRearView  = false;
                CarAlarm             = false;
                CarAirConditioner    = false;
                CarLuxuryHoops       = false;
                lstOriginalVehiculos = await CarModel.GetCars();

                lstVehiculos = new ObservableCollection <CarModel>(lstOriginalVehiculos);
                App.Current.MainPage.DisplayAlert("Success", "Se ha agregado el carro correctamente.", "OK");
                PageManager(1);
            }
            else
            {
                App.Current.MainPage.DisplayAlert("Error", "Se ha generado un error.", "OK");
            }
        }
Exemple #24
0
 public CarCreationPage SetDepositAmount(CarModel car)
 {
     DepositAmountField.SendKeys(car.Setting.DepositAmount.ToString());
     return(new CarCreationPage());
 }
 public int Insert(CarModel product)
 {
     throw new NotImplementedException();
 }
Exemple #26
0
 public async Task <bool> Update(CarModel car)
 {
     _context.Cars.Update(car);
     return(await _context.SaveChangesAsync() > 0);
 }
 public int Update(CarModel product)
 {
     throw new NotImplementedException();
 }
Exemple #28
0
 /// <inheritdoc />
 public override void Remove(CarModel cm)
 {
     cm.Engine = null;
 }
Exemple #29
0
 public void Create(CarModel carModel)
 {
     //type casting: Car
     //carRepository.Create(carModel);
 }
Exemple #30
0
 public int InsertCar(CarModel car)
 {
     throw new NotImplementedException();
 }
Exemple #31
0
        public void Remove(int id)
        {
            CarModel carModel = carModels.Where(c => c.CarModelId == id).FirstOrDefault();

            carModels.Remove(carModel);
        }
        public void AddNewCar(CarModel carModel)
        {
            var car = DALObjectCreator.carObject(carModel);

            carModelRepo.Insert(car);
        }
Exemple #33
0
 public void Add(CarModel carModel)
 {
     carModels.Add(carModel);
 }
Exemple #34
0
        public IActionResult Post([FromBody] CarModel carModel)
        {
            var newCarId = _carService.AddCar(carModel);

            return(Ok(newCarId));
        }
        public virtual async Task <ActionResult <int> > Update(CarModel item)
        {
            var updateItemId = await _carService.UpsertAsync(item);

            return(Ok(updateItemId));
        }