public async Task <IActionResult> Edit(int id, [Bind("TrialGroupId,TrialGroupNr,PlantId,FieldBlockId")] PtsTrialGroup ptsTrialGroup)
        {
            if (id != ptsTrialGroup.TrialGroupId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ptsTrialGroup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PtsTrialGroupExists(ptsTrialGroup.TrialGroupId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FieldBlockId"] = new SelectList(_context.PtsFieldBlock, "FieldBlockId", "BlockChar", ptsTrialGroup.FieldBlockId);
            ViewData["PlantId"]      = new SelectList(_context.PtsPlant, "PlantId", "PlantName", ptsTrialGroup.PlantId);
            return(View(ptsTrialGroup));
        }
        public async Task <IActionResult> Create([Bind("TrialGroupId,TrialGroupNr,PlantId,FieldBlockId")] PtsTrialGroup ptsTrialGroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ptsTrialGroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FieldBlockId"] = new SelectList(_context.PtsFieldBlock, "FieldBlockId", "BlockChar", ptsTrialGroup.FieldBlockId);
            ViewData["PlantId"]      = new SelectList(_context.PtsPlant, "PlantId", "PlantName", ptsTrialGroup.PlantId);
            return(View(ptsTrialGroup));
        }