Example #1
0
        private async void AddCar()
        {
            CarModel car = new CarModel();

            car.Brand         = Vehiculo.Brand;
            car.Model         = Vehiculo.Model;
            car.Colour        = Vehiculo.Colour;
            car.Transmision   = Vehiculo.Transmision;
            car.Year          = Vehiculo.Year;
            car.Miles         = Vehiculo.Miles;
            car.Type          = Vehiculo.Type;
            car.Price         = Vehiculo.Price;
            car.DoorsQuantity = Vehiculo.DoorsQuantity;
            car.Capacity      = Vehiculo.Capacity;
            car.Motor         = Vehiculo.Motor;
            car.Gas           = Vehiculo.Gas;

            car.ElectricWindows   = Vehiculo.ElectricWindows;
            car.CentralLock       = Vehiculo.CentralLock;
            car.HydraulicSteering = Vehiculo.HydraulicSteering;
            car.ElectricRearView  = Vehiculo.ElectricRearView;
            car.Alarm             = Vehiculo.Alarm;
            car.AirConditioner    = Vehiculo.AirConditioner;
            car.LuxuryHoops       = Vehiculo.LuxuryHoops;
            car.lstImagenes       = lstImages;

            string saved = "";

            saved = await CarModel.SaveCar(car);

            if (Int32.Parse(saved) > 0)
            {
                lstImages = new ObservableCollection <ImageFile>();
                Vehiculo  = new CarModel();

                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");
            }
        }
        private async Task InitClass()
        {
            lstPages = await MasterPageItem.GetPages();

            IsBusy = true;
            lstOriginalVehiculos = await CarModel.GetCars();

            lstVehiculos = new ObservableCollection <CarModel>(lstOriginalVehiculos);
            if (UserSystem.CountUserSystem() > 0)
            {
                UserSystem     usuario        = UserSystem.GetUserRealm();
                LoginViewModel loginViewModel = new LoginViewModel();
                loginViewModel.User     = usuario.Email;
                loginViewModel.Password = usuario.Pass;
                loginViewModel.Recordar = false;
                loginViewModel.Login();
            }
            IsBusy = false;
        }
        public string GetCars(CarModel car)
        {
            string ans = car.GetCars();

            return(ans);
        }