public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(TrackingLog).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrackingLogExists(TrackingLog.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } ClaimsPrincipal currentUser = this.User; var currentUserID = currentUser.FindFirst(ClaimTypes.NameIdentifier).Value; TrackingLog.OwnerID = currentUserID; _context.Tracking.Add(TrackingLog); await _context.SaveChangesAsync(); return(RedirectToPage("./Log")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } TrackingLog = await _context.Tracking.FindAsync(id); if (TrackingLog != null) { _context.Tracking.Remove(TrackingLog); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }