// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(MiningContracts).State = EntityState.Modified; try { await _context.SaveChangesAsync(); TempData["Referrers"] = "Edited"; } catch (DbUpdateConcurrencyException) { if (!MiningContractsExists(MiningContracts.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.MiningContracts.Add(MiningContracts); await _context.SaveChangesAsync(); TempData["Referrer"] = "SaveRegister"; return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } MiningContracts = await _context.MiningContracts.FindAsync(id); if (MiningContracts != null) { _context.MiningContracts.Remove(MiningContracts); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }