コード例 #1
0
        public IActionResult OnGet(int granolaId)
        {
            Granola = granolaData.GetById(granolaId);

            if (Granola == null)
            {
                return(RedirectToPage("./ErrorPage"));
            }

            return(Page());
        }
コード例 #2
0
        public IActionResult OnGet(int?granolaId)
        {
            Tipos = htmlHelper.GetEnumSelectList <GranolaTipo>();
            if (granolaId.HasValue)
            {
                Granola = granolaData.GetById(granolaId.Value);
            }
            else
            {
                Granola = new Granola();
            }


            if (Granola == null)
            {
                return(RedirectToPage("./ErrorPage"));
            }
            return(Page());
        }