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