Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var model = new HomePageViewModels();

            model.Restaurants    = _restaurantData.GetAll();
            model.CurrentMessage = _greeter.GetGreeting();
            model.Image          = "~/node_modules/images/Montenegro_1.jpg";
            //API responses friendly
            // return new ObjectResult(model);

            //produces a view result
            return(View(model));
        }
        public ActionResult Index(HomePageViewModels model)
        {
            var bandColors = _service.GetAllBandColors();
            var postmodel  = _factoryMethod.CreateHomeViewModel(bandColors);

            if (!ModelState.IsValid)
            {
                return(View(postmodel));
            }

            postmodel.Result = _service.CalculateResistor(model.SelectedBandA, model.SelectedBandB, model.SelectedBandC, model.SelectedBandD);

            return(View(postmodel)
                   );
        }
Ejemplo n.º 3
0
 public HomePage()
 {
     InitializeComponent();
     BindingContext       = viewModel = new HomePageViewModels();
     viewModel.Navigation = this.Navigation;
 }
        public HomePage()
        {
            InitializeComponent();

            DataContext = new HomePageViewModels();
        }