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

            ProviderX = await _context.Providers.FirstOrDefaultAsync(m => m.id == id);

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

            ProviderX = await _context.Providers.FindAsync(id);

            if (ProviderX != null)
            {
                _context.Providers.Remove(ProviderX);
                Log log = new Log();
                log.date   = DateTime.Now;
                log.action = "Remoção de Fornecedor";
                log.log    = ProviderX.nomeFantasia;
                _context.Lista.Add(log);
                await _context.SaveChangesAsync();
            }

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