public async Task <IActionResult> Edit(string id, [Bind("RoastingLogId,RoasterName,RoastingLevelId,RoastingDate,StartTime,EndTime,StartWeight,FinishWeight,LossPercent,ProductId,StartTemp,AmbientTemp,AfterFillingTemp,FirstCrackTime,SecondCrackTime,HasChild,createdAt")] RoastingLog roastingLog) { if (id != roastingLog.RoastingLogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(roastingLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoastingLogExists(roastingLog.RoastingLogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Product, "productId", "productId", roastingLog.ProductId); ViewData["RoastingLevelId"] = new SelectList(_context.RoastingLevel, "RoastingLevelId", "RoastingLevelId", roastingLog.RoastingLevelId); return(View(roastingLog)); }
// GET: RoastingLog/Create public IActionResult Create() { RoastingLog roastLog = new RoastingLog(); ViewData["ProductId"] = new SelectList(_context.Product, "productId", "productId"); ViewData["RoastingLevelId"] = new SelectList(_context.RoastingLevel, "RoastingLevelId", "RoastingLevelId"); return(View(roastLog)); }
public async Task <IActionResult> Create([Bind("RoastingLogId,RoasterName,RoastingLevelId,RoastingDate,StartTime,EndTime,StartWeight,FinishWeight,LossPercent,ProductId,StartTemp,AmbientTemp,AfterFillingTemp,FirstCrackTime,SecondCrackTime,HasChild,createdAt")] RoastingLog roastingLog) { if (ModelState.IsValid) { _context.Add(roastingLog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Product, "productId", "productId", roastingLog.ProductId); ViewData["RoastingLevelId"] = new SelectList(_context.RoastingLevel, "RoastingLevelId", "RoastingLevelId", roastingLog.RoastingLevelId); return(View(roastingLog)); }