public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Wine).State = EntityState.Modified;//update wine try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WineExists(Wine.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.RateList.Add(RateList);//adding the ratelist await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Customer.Add(Customer);//adding customer await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Wines.Add(Wine);//add wine await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Wine = await _context.Wines.FindAsync(id); if (Wine != null) { _context.Wines.Remove(Wine);//delete wine await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Customer = await _context.Customer.FindAsync(id); if (Customer != null) { _context.Customer.Remove(Customer);//delete customer await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } RateList = await _context.RateList.FindAsync(id); if (RateList != null) { _context.RateList.Remove(RateList);//delete ratelist await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }