// 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()); } DeskQuote.QuotePrice = DeskQuote.GetDeskQuote(_context); DeskQuote.QuoteDate = DateTime.Now; _context.Attach(DeskQuote).State = EntityState.Modified; _context.Attach(DeskQuote.Desk).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeskQuoteExists(DeskQuote.DeskQuoteId)) { 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.Attach(DeskQuote).State = EntityState.Modified; try { DeskQuote.Area = DeskQuote.surfaceCalc(); DeskQuote.Cost = DeskQuote.totalCalc(); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeskQuoteExists(DeskQuote.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { // if (!ModelState.IsValid) // { // return Page(); // } DeskQuote.Desk.DesktopMaterialID = Convert.ToInt16(selectedMaterial); DeskQuote.DaysToCompleteID = Convert.ToInt16(selectedDays); _context.Attach(DeskQuote).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeskQuoteExists(DeskQuote.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please 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(DesktopMaterial).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DesktopMaterialExists(DesktopMaterial.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please 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(Deskquote).State = EntityState.Modified; try { Deskquote.Area = Deskquote.CalculateArea(); Deskquote.AreaCost = Deskquote.CalculateAreaCost(); Deskquote.Material = Request.Form["material"]; Deskquote.MaterialCost = Deskquote.CalculateMaterialCost(Deskquote.Material); Deskquote.DrawerCost = Deskquote.Drawers * Deskquote.COST_PER_DRAWER; Deskquote.Rush = Request.Form["rush"]; Deskquote.ShippingCost = Deskquote.CalculateShippingCost(Deskquote.Rush, Deskquote.Area); Deskquote.Quote = Deskquote.CalculateQuoteTotal(); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeskquoteExists(Deskquote.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
// To protect from overposting attacks, please 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(Order).State = EntityState.Modified; try { Order.QuoteTotal = Order.getTotalCost(); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(Order.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()); } DeskQuote.QuoteDate = DateTime.Now; // Get the material for calculating the price DeskQuote.Desk.DesktopMaterial = _context.DesktopMaterial .FirstOrDefault(d => d.DesktopMaterialId == DeskQuote.Desk.DesktopMaterialId); // Get the delivery option for calculating the price DeskQuote.DeliveryOption = _context.DeliveryOption .FirstOrDefault(d => d.DeliveryOptionId == DeskQuote.DeliveryOptionId); DeskQuote.QuotePrice = DeskQuote.CalculatePriceQuote(); _context.Attach(DeskQuote).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeskQuoteExists(DeskQuote.DeskQuoteId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }