Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("SemestrVidUchebRabotiId,VidUchebRabotiNameId,SemestrId,Hour")] SemestrVidUchebRaboti semestrVidUchebRaboti, int SemestrId)
        {
            if (id != semestrVidUchebRaboti.SemestrVidUchebRabotiId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(semestrVidUchebRaboti);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SemestrVidUchebRabotiExists(semestrVidUchebRaboti.SemestrVidUchebRabotiId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index), new { SemestrId }));
            }

            ViewData["VidUchebRabotiNameId"] = new SelectList(_context.VidUchebRabotiNames, "VidUchebRabotiNameId", "VidUchebRabotiNameId", semestrVidUchebRaboti.VidUchebRabotiNameId);
            return(View(semestrVidUchebRaboti));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("SemestrVidUchebRabotiId,VidUchebRabotiNameId,SemestrId,Hour")] SemestrVidUchebRaboti semestrVidUchebRaboti, int?SemestrId)
        {
            if (ModelState.IsValid)
            {
                _context.Add(semestrVidUchebRaboti);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index), new { SemestrId }));
            }

            ViewBag.SemestrId = SemestrId;
            ViewData["VidUchebRabotiNameId"] = new SelectList(_context.VidUchebRabotiNames, "VidUchebRabotiNameId", "VidUchebRabotiNameName", semestrVidUchebRaboti.VidUchebRabotiNameId);
            return(View(semestrVidUchebRaboti));
        }