Exemple #1
0
        public async Task <IActionResult> OnGetAsync(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            //Clients = await _context.Clients.SingleOrDefaultAsync(m => m.Pk == id);
            Clients = await _context.Clients
                      .Where(x => x.TenantID == _options.Value.Debug.TenantID)
                      .Where(x => x.ID == id)
                      .FirstOrDefaultAsync();

            if (Clients == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #2
0
        public async Task <IActionResult> OnPostAsync(Guid id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            //Clients = await _context.Clients.FindAsync(id);
            Clients = await _context.Clients
                      .Where(x => x.TenantID == _options.Value.Debug.TenantID)
                      .Where(x => x.ID == id)
                      .FirstOrDefaultAsync();

            if (Clients != null)
            {
                _context.Clients.Remove(Clients);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }