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

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

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

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

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

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