pull/13808/head
noctwolf 2019-08-13 08:21:28 -05:00 committed by Rick Anderson
parent 9ae9b670b5
commit f533e51bff
1 changed files with 1 additions and 3 deletions

View File

@ -47,8 +47,6 @@ namespace ContactManager.Pages.Contacts
public async Task<IActionResult> OnPostAsync(int id) public async Task<IActionResult> OnPostAsync(int id)
{ {
Contact = await Context.Contact.FindAsync(id);
var contact = await Context var contact = await Context
.Contact.AsNoTracking() .Contact.AsNoTracking()
.FirstOrDefaultAsync(m => m.ContactId == id); .FirstOrDefaultAsync(m => m.ContactId == id);
@ -66,7 +64,7 @@ namespace ContactManager.Pages.Contacts
return new ChallengeResult(); return new ChallengeResult();
} }
Context.Contact.Remove(Contact); Context.Contact.Remove(contact);
await Context.SaveChangesAsync(); await Context.SaveChangesAsync();
return RedirectToPage("./Index"); return RedirectToPage("./Index");