Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("StudyStatusId,StudyStatusDesc")] StudyStatus studyStatus)
        {
            if (id != studyStatus.StudyStatusId)
            {
                return(RedirectToAction("Index", "Errors"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(studyStatus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudyStatusExists(studyStatus.StudyStatusId))
                    {
                        return(RedirectToAction("Index", "Errors"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(studyStatus));
        }
Пример #2
0
        public Study(string institution, string title, StudyStatus status)
        {
            Institution = institution;
            Title       = title;
            Status      = status;

            Validate();
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("StudyStatusId,StudyStatusDesc")] StudyStatus studyStatus)
        {
            if (ModelState.IsValid)
            {
                _context.Add(studyStatus);
                await _context.SaveChangesAsync();

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