Beispiel #1
0
        // HTTP GET
        public async Task <IActionResult> Edit(long id)
        {
            if (!IsLoggedIn())
            {
                return(RedirectToPage("/Account/Login"));
            }
            Infant infant = await context.Infants.FindAsync(id);

            if (!IsInfantOwner(infant))
            {
                return(RedirectToPage("/Error/Error404"));
            }
            InfantViewModel model = InfantViewModelFactory.Edit(infant);

            return(View("InfantEditor", model));
        }
Beispiel #2
0
        public async Task <IActionResult> Details(int id)
        {
            if (!IsLoggedIn())
            {
                return(RedirectToPage("/Account/Login"));
            }
            Infant i = await context.Infants.FirstOrDefaultAsync(i => i.InfantId == id);

            if (!IsInfantOwner(i))
            {
                return(RedirectToPage("/Error/Error404"));
            }
            InfantViewModel model = InfantViewModelFactory.Details(i);

            return(View("InfantEditor", model));
        }