// 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(PhoneNumber).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PhoneNumberExists(PhoneNumber.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.VoucherAccountLut.Add(VoucherAccountLut); await _context.SaveChangesAsync(); 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.MemberTrust.Add(MemberTrust); await _context.SaveChangesAsync(); 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()); } var entry = _context.Add(new Member()); entry.CurrentValues.SetValues(Member); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } MemberTrust = await _context.MemberTrust.FindAsync(id); if (MemberTrust != null) { _context.MemberTrust.Remove(MemberTrust); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } PhoneNumber = await _context.PhoneNumber.FindAsync(id); if (PhoneNumber != null) { _context.PhoneNumber.Remove(PhoneNumber); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Currency = await _context.Currency.FindAsync(id); if (Currency != null) { _context.Currency.Remove(Currency); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } EmailAddress = await _context.EmailAddress.FindAsync(id); if (EmailAddress != null) { _context.EmailAddress.Remove(EmailAddress); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } VoucherAccountLut = await _context.VoucherAccountLut.FindAsync(id); if (VoucherAccountLut != null) { _context.VoucherAccountLut.Remove(VoucherAccountLut); await _context.SaveChangesAsync(); } 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()); } var newIdentity = new MemberIdentity(); newIdentity.WhenCreated = DateTime.Now; newIdentity.MemberDetailsState = MemberDetailsState.Pending; newIdentity.MemberId = 1; var entry = _context.Add(newIdentity); entry.CurrentValues.SetValues(MemberIdentity); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } // Member = await _context.Member.FindAsync(id); // if (Member != null) // { // _context.Member.Remove(Member); // await _context.SaveChangesAsync(); // } // return RedirectToPage("./Index"); var member = await _context.Member .AsNoTracking() .FirstOrDefaultAsync(m => m.Id == id); if (member == null) { return(NotFound()); } try { _context.Member.Remove(member); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); } catch (DbUpdateException /* ex */) { //Log the error (uncomment ex variable name and write a log.) return(RedirectToAction("./Delete", new { id, saveChangesError = true })); } }