public async Task <IActionResult> OnPostAsync(int?id) { if (!ModelState.IsValid) { return(Page()); } Complains = await _context.Complain.FirstOrDefaultAsync(m => m.ComplainID == id); Order = await _context.Order.FirstOrDefaultAsync(m => m.OrderID == Complains.OrderID); Order.Status = "Complete"; Complains.Status = "Complete"; _context.Attach(Order).State = EntityState.Modified; _context.Attach(Order).State = EntityState.Modified; if (Complain != null) { _context.Attach(Complain).State = EntityState.Modified; await _context.SaveChangesAsync(); } if (!ModelState.IsValid) { return(Page()); } var a = new Claim(); a.DateClaim = DateTime.Now; a.Status = "Complete"; a.ComplainID = Complains.ComplainID; Claim = a; _context.Claim.Add(Claim); await _context.SaveChangesAsync(); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(Order.OrderID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Complain")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Rival_Product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Rival_ProductExists(Rival_Product.RivProductID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Product_Loss_Reduction).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Product_Loss_ReductionExists(Product_Loss_Reduction.Product_Loss_ReductionID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./ProductLossReduction")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Manufacture).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ManufactureExists(Manufacture.ManufactureID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./List")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(Page()); } Order.Status = "InComplete"; if (Order != null) { _context.Attach(Order).State = EntityState.Modified; await _context.SaveChangesAsync(); } if (!ModelState.IsValid) { return(Page()); } var a = new Complain(); a.DateComplain = DateTime.Now; a.Status = "InComplete"; a.OrderID = Order.OrderID; Complain = a; _context.Complain.Add(Complain); await _context.SaveChangesAsync(); return(RedirectToPage("./ViewOrder", new { id = Order.CustomerID })); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(SurveyOperators).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SurveyOperatorsExists(SurveyOperators.SurveyOperatorsID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Surveys")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Product = await _context.Product.FirstOrDefaultAsync(m => m.ProductID == Project_Product.ProductID); double Price = Product.CostPrice; int Qty = Project_Product.Qty; int IDProJect = Project_Product.ProjectID; Product = await _context.Product.FirstOrDefaultAsync(m => m.ProductID == Project_Product.ProductID); double Price2 = Product.SellingPrice; int Qty2 = Project_Product.Qty; int IDProJect2 = Project_Product.ProjectID; _context.Project_Product.Add(Project_Product); await _context.SaveChangesAsync(); double SumTotalPrice = Qty * Price; Project = await _context.Project.FirstOrDefaultAsync(m => m.ProjectID == IDProJect); Project.Cost = Project.Cost + SumTotalPrice; double SumTotalPrice2 = Qty2 * Price2; Project = await _context.Project.FirstOrDefaultAsync(m => m.ProjectID == IDProJect2); Project.CostGoal = Project.CostGoal + SumTotalPrice2; _context.Attach(Project).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectExists(Project.ProjectID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Product = await _context.Product.FirstOrDefaultAsync(m => m.ProductID == Order_Product.ProductID); double Price = Product.SellingPrice; int Qty = Order_Product.Qty; int IDOrder = Order_Product.OrderID; _context.Order_Product.Add(Order_Product); await _context.SaveChangesAsync(); double SumTotalPrice = Qty * Price; Order = await _context.Order.FirstOrDefaultAsync(m => m.OrderID == IDOrder); Order.Total = Order.Total + SumTotalPrice; _context.Attach(Order).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(Order.OrderID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./ViewOrder", new { id = Order.CustomerID })); }