/// <summary> /// Ons the post async. /// </summary> /// <returns>The post async.</returns> public async Task <IActionResult> OnPostAsync() { _logger.LogDebug("ChipCardProfiles/Create/OnPostAsync"); if (!ModelState.IsValid) { return(Page()); } var emptyChipCardProfile = new ChipCardProfile(); if (await TryUpdateModelAsync <ChipCardProfile>( emptyChipCardProfile, "chipcardprofile", // Prefix for form value c => c.Number, c => c.LastUpdate ).ConfigureAwait(false)) { _context.ChipCardProfile.Add(emptyChipCardProfile); await _context.SaveChangesAsync().ConfigureAwait(false); return(RedirectToPage("./Index")); } return(null); }
/// <summary> /// Ons the get async. /// </summary> /// <returns>The get async.</returns> /// <param name="id">Identifier.</param> public async Task <IActionResult> OnGetAsync(long?id) { _logger.LogDebug($"ChipCardProfile/Edit/OnGetAsync({ id })"); if (id == null) { return(NotFound()); } ChipCardProfile = await _context.ChipCardProfile.FindAsync(id).ConfigureAwait(false); if (ChipCardProfile == null) { return(NotFound()); } return(Page()); }
/// <summary> /// Ons the get async. /// </summary> /// <returns>The get async.</returns> /// <param name="id">Identifier.</param> public async Task <IActionResult> OnGetAsync(int?id) { _logger.LogDebug($"ChipCardProfiles/Details/OnGetAsync ({ id })"); if (id == null) { return(NotFound()); } ChipCardProfile = await _context.ChipCardProfile .Include(c => c.Employee) .AsNoTracking() .FirstOrDefaultAsync(m => m.ID == id).ConfigureAwait(false); if (ChipCardProfile == null) { return(NotFound()); } return(Page()); }