// 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)); }
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)); }