public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(DeskQuote).State = EntityState.Modified; try { DeskQuote.Total = DeskQuoteCalculations.getPrice(DeskQuote.Depth, DeskQuote.Width, DeskQuote.Material, DeskQuote.Rush, DeskQuote.Drawers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeskQuoteExists(DeskQuote.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Details", new { id = DeskQuote.ID })); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } DeskQuote.Total = DeskQuoteCalculations.getPrice(DeskQuote.Depth, DeskQuote.Width, DeskQuote.Material, DeskQuote.Rush, DeskQuote.Drawers); _context.DeskQuote.Add(DeskQuote); await _context.SaveChangesAsync(); return(RedirectToPage("./Details", new { id = DeskQuote.ID })); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } DeskQuote = await _context.DeskQuote.FindAsync(id); if (DeskQuote != null) { _context.DeskQuote.Remove(DeskQuote); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }