public IActionResult OnPost() { Case = _context.Case.Find(CaseClosureForm.CaseId); if (!ModelState.IsValid) { return(Page()); } Case.Status = "Closed"; Case.ClosedDate = CaseClosureForm.ClosureDate; _context.SaveChanges(); return(RedirectToPage("/Cases/Index")); }
public IActionResult OnPost() { if (!ModelState.IsValid) { ViewData["ProductId"] = new SelectList(_context.Set <Product>(), "ID", "Name"); return(Page()); } var ordLineItem = new OrderLineItem(); ordLineItem.OrderId = orderLineItem.OrderId; ordLineItem.ProductId = orderLineItem.ProductId; ordLineItem.Quantity = orderLineItem.Quantity; _context.OrderLineItem.Add(ordLineItem); _context.SaveChanges(); return(RedirectToPage("/Orders/Details", new { Id = ordLineItem.OrderId })); }