Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("TrialTypeId,TrialTypeName,TrialTypeDescription")] PtsTrialType ptsTrialType)
        {
            if (id != ptsTrialType.TrialTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ptsTrialType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PtsTrialTypeExists(ptsTrialType.TrialTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ptsTrialType));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("TrialTypeId,TrialTypeName,TrialTypeDescription")] PtsTrialType ptsTrialType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ptsTrialType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(ptsTrialType));
        }