Exemplo n.º 1
0
        public PlacesPage()
        {
            InitializeComponent();

            BindingContext = zatwierdzonevm = new PlacesViewModel();
            viewModel      = new PrzyjmijMMSkanowanieViewModel();
        }
Exemplo n.º 2
0
        public IActionResult Create(PlacesViewModel lugar)
        {
            try
            {
                var lugarDB = new PlacesModel();

                lugarDB.name            = lugar.name;
                lugarDB.email           = lugar.email;
                lugarDB.cellphone       = lugar.cellphone;
                lugarDB.Id              = lugar.Id;
                lugarDB.addressStreet   = lugar.addressStreet;
                lugarDB.addressNumber1  = lugar.addressNumber1;
                lugarDB.addressNumber2  = lugar.addressNumber2;
                lugarDB.addressNumber3  = lugar.addressNumber3;
                lugarDB.addressLocation = lugar.addressLocation;
                lugarDB.address         = lugar.addressStreet + " " + lugar.addressNumber1 + " # " + lugar.addressNumber2 + " - " + lugar.addressNumber3 + " " + lugar.addressLocation;
                //TODO: Add insert logic here
                _context.Lugares.Add(lugarDB);
                _context.SaveChanges();

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        /// <summary>
        /// Navigates to places page and sets it as active.
        /// </summary>
        /// <param name="placesViewModel">Places page view model.</param>
        public void NavigateToPlacesPage(PlacesViewModel placesViewModel)
        {
            var placesPage = new PlacesPage();

            placesPage.BindingContext = placesViewModel;
            App.Current.MainPage      = new NavigationPage(placesPage);
        }
Exemplo n.º 4
0
        public HotelPage()
        {
            InitializeComponent();
            hotelViewModel           = new GetHotelViewModel();
            hotelList.BindingContext = hotelViewModel;

            placesViewModel     = new PlacesViewModel();
            city.BindingContext = placesViewModel;
        }
Exemplo n.º 5
0
        public TrainPage()
        {
            InitializeComponent();
            trainViewModel           = new GetTrainViewModel();
            TrainList.BindingContext = trainViewModel;

            placesViewModel       = new PlacesViewModel();
            SPlace.BindingContext = placesViewModel;
            DPlace.BindingContext = placesViewModel;
        }
        public FlightTable()
        {
            InitializeComponent();
            flightTableViewModel      = new FlightTableViewModel();
            FlightList.BindingContext = flightTableViewModel;

            placesViewModel       = new PlacesViewModel();
            SPlace.BindingContext = placesViewModel;
            DPlace.BindingContext = placesViewModel;
        }
        public BuyFlightPage()
        {
            InitializeComponent();
            flightViewModel           = new FlightScheduleViewModel();
            FlightList.BindingContext = flightViewModel;

            placesViewModel       = new PlacesViewModel();
            SPlace.BindingContext = placesViewModel;
            DPlace.BindingContext = placesViewModel;
        }
        public async void OnItemSelect(object sender, SelectedItemChangedEventArgs args)
        {
            (sender as ListView).SelectedItem = null;

            if (args.SelectedItem != null)
            {
                placesViewModel       = args.SelectedItem as PlacesViewModel;
                placeform             = new PlacesForm(placesViewModel.Places);
                placeform.DataSender += UpdateList;
                await Navigation.PushAsync(placeform);
            }
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();
            PlacesList.ItemsSource = null;
            var placeslist = PlacesViewModel.GetCollectionList(PlacesModel.PlacesList);
            var _places    = new ObservableCollection <PlacesViewModel>();

            foreach (var place in placeslist)
            {
                _places.Add(place);
            }
            PlacesList.ItemsSource = _places;
        }
 public override ActionResult Edit(int?EditID)
 {
     if ((ModelState.IsValid) && (EditID != null))
     {
         PlacesViewModel placesViewModel = new PlacesViewModel();
         placesViewModel.PlaceModel = placeTable.GetAll().Where(p => p.ID == EditID).FirstOrDefault();
         return(View(placesViewModel));
     }
     else
     {
         SetStatus("Place Not Found to Edit");
         return(View("Error"));
     }
 }
        public ActionResult Edit(PlacesViewModel placeToEdit)
        {
            try
            {
                placeToEdit.PlaceModel = placeTable.Update(placeToEdit.PlaceModel);
                Response.StatusCode    = placeToEdit == null || placeToEdit.PlaceModel == null?SetStatus("Created") : SetStatus(null);

                return(RedirectToAction("Index", "Places"));
            }
            catch (Exception ex)
            {
                Response.StatusCode = SetStatus(ex.Message);
                return(View("Index", "Place"));
            }
        }
        public override ActionResult Index()
        {
            List <Place> places = new List <Place>();

            try
            {
                places = placeTable.GetAll().ToList();
                PlacesViewModel placesViewModel = new PlacesViewModel();
                placesViewModel.ListofAllPlaces = places;
                return(View(placesViewModel));
            }
            catch (Exception ex)
            {
                Response.StatusCode = SetStatus(ex.Message);
                return(View("Error"));
            }
        }
Exemplo n.º 13
0
 public static Locais ParseToDB(this PlacesViewModel item)
 {
     if (item != null)
     {
         return(new Locais()
         {
             Código = item.Code,
             Descrição = item.Description,
             Endereço = item.Address,
             CódigoPostal = item.Postalcode,
             Localidade = item.Locality,
             ResponsávelReceção = item.Responsiblerecept,
             DataHoraCriação = string.IsNullOrEmpty(item.CreateDate) ? (DateTime?)null : DateTime.Parse(item.CreateDate),
             DataHoraModificação = string.IsNullOrEmpty(item.UpdateDate) ? (DateTime?)null : DateTime.Parse(item.UpdateDate),
             UtilizadorCriação = item.CreateUser,
             UtilizadorModificação = item.UpdateUser,
             Contacto = item.Contact
         });
     }
     return(null);
 }
Exemplo n.º 14
0
        public async Task <ActionResult> Create(PlacesViewModel route)
        {
            User user = await GetCurrentUserAsync();

            if (user != null)
            {
                Route tmp_route = new Route
                {
                    Name         = route.Name,
                    isForPremium = false,
                    UserName     = user.UserName,
                    CountOfViews = 0,
                    RouteUserId  = user.Id,
                };
                _context.Routes.Add(tmp_route);
                int id = tmp_route.Id;
                for (int i = 0; i < route.Places.Count(); i++)
                {
                    if (route.Places[i].Lg <-180.0 || route.Places[i].Lg> 180.0 ||
                        route.Places[i].Lt <-90.0 || route.Places[i].Lg> 90.0)
                    {
                        return(NotFound());
                    }
                    Place tmp_place = new Place
                    {
                        Lt        = route.Places[i].Lt,
                        Lg        = route.Places[i].Lg,
                        InfoAbout = route.Places[i].Info,
                        RouteId   = id
                    };
                    _context.Places.Add(tmp_place);
                }

                await _context.SaveChangesAsync();

                return(LocalRedirect("~/RouteList/"));
            }
            return(NotFound());
        }
Exemplo n.º 15
0
 public PlacesViewController(IntPtr handle) : base(handle)
 {
     ViewModel = ServiceLocator.Instance.Get <PlacesViewModel>();
 }
Exemplo n.º 16
0
 public PlaceListFragment()
 {
     ViewModel             = ServiceLocator.Instance.Get <PlacesViewModel>();
     ViewModel.ErrorAction = ToastMessage;
 }
        public JsonResult GetPlaces([FromBody] int placeId)
        {
            PlacesViewModel PlacesData = DBPlaces.ParseToViewModel(DBPlaces.GetById(placeId));

            return(Json(PlacesData));
        }