public async Task <IActionResult> Edit(int id, [Bind("OrderId,DailyDeal,Quantity,Price,OrderType,CurrentStatus,OrderMessage,Table,Message")] DailyDealOrder dailyDealOrder) { if (id != dailyDealOrder.OrderId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dailyDealOrder); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DailyDealOrderExists(dailyDealOrder.OrderId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DailyDeal"] = new SelectList(_context.DailyDeal, "DailyDealId", "DailyDealId", dailyDealOrder.DailyDeal); ViewData["OrderType"] = new SelectList(_context.OrderType, "TypeId", "OrderType1", dailyDealOrder.OrderType); return(View(dailyDealOrder)); }
public async Task <IActionResult> Create([Bind("OrderId,DailyDeal,Quantity,Price,OrderType,CurrentStatus,OrderMessage,Table,Message")] DailyDealOrder dailyDealOrder) { if (ModelState.IsValid) { _context.Add(dailyDealOrder); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DailyDeal"] = new SelectList(_context.DailyDeal, "DailyDealId", "DailyDealId", dailyDealOrder.DailyDeal); ViewData["OrderType"] = new SelectList(_context.OrderType, "TypeId", "OrderType1", dailyDealOrder.OrderType); return(View(dailyDealOrder)); }