示例#1
0
        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));
        }
示例#2
0
        // 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));
        }
示例#3
0
        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));
        }