public async Task <IActionResult> Edit(int id, [Bind("Id,Name,RegistereddDate")] PrepaidCustomer prepaidCustomer) { if (id != prepaidCustomer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(prepaidCustomer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrepaidCustomerExists(prepaidCustomer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(prepaidCustomer)); }
public async Task <IActionResult> Create([Bind("Id,Name,RegistereddDate")] PrepaidCustomer prepaidCustomer) { if (ModelState.IsValid) { _context.Add(prepaidCustomer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(prepaidCustomer)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } PrepaidCustomer = await _context.PrepaidCustomer.FirstOrDefaultAsync(m => m.Id == id); if (PrepaidCustomer == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } PrepaidCustomer = await _context.PrepaidCustomer.FindAsync(id); if (PrepaidCustomer != null) { _context.PrepaidCustomer.Remove(PrepaidCustomer); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }