示例#1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CMCAssign = await _context.CMCAssign.FindAsync(id);

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

            return(RedirectToPage("./Index"));
        }
示例#2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CMCAssign = await _context.CMCAssign
                        .Include(c => c.Charger)
                        .Include(c => c.Customer)
                        .Include(c => c.Meter).FirstOrDefaultAsync(m => m.ChargerID == id);

            if (CMCAssign == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            CMCAssign = await _context.CMCAssign
                        .Include(c => c.Charger)
                        .Include(c => c.Customer)
                        .Include(c => c.Meter).FirstOrDefaultAsync(m => m.ChargerID == id);

            if (CMCAssign == null)
            {
                return(NotFound());
            }
            ViewData["ChargerID"]  = new SelectList(_context.Charger, "ID", "ID");
            ViewData["CustomerID"] = new SelectList(_context.Customers, "ID", "ID");
            ViewData["MeterID"]    = new SelectList(_context.Meter, "ID", "ID");
            return(Page());
        }