Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        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"));
        }