Exemplo n.º 1
0
        public ActionResult Index(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index", "Apiaries"));                     //if no parameter provided, return to index
            }
            var apiary = _context.Apiaries.SingleOrDefault(a => a.ApiaryId == id); //get the apiary object for the parameter id

            if (apiary == null)
            {
                return(HttpNotFound());
            }
            var viewModel = new ApiaryDetailsViewModel(apiary);    //create the viewmodel object for the found apiary object

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ApiaryDetailsPage(ApiaryDetailsViewModel viewModel)
        {
            InitializeComponent();

            BindingContext = _viewModel = viewModel;
        }