Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Degreeofmaturity,Language")] DegreeOfMaturityTrans degreeOfMaturityTrans)
        {
            if (id != degreeOfMaturityTrans.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(degreeOfMaturityTrans);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DegreeOfMaturityTransExists(degreeOfMaturityTrans.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["Degreeofmaturity"] = new SelectList(_context.DegreeOfMaturity, "Id", "Id", degreeOfMaturityTrans.Degreeofmaturity);
            ViewData["Language"]         = new SelectList(_context.Languages, "Id", "Code", degreeOfMaturityTrans.Language);
            return(View(degreeOfMaturityTrans));
        }
Example #2
0
        public async Task <IActionResult> Create(int DegreeOfMaturity, [Bind("Id,Name,Degreeofmaturity,Language")] DegreeOfMaturityTrans degreeOfMaturityTrans)
        {
            if (ModelState.IsValid)
            {
                if (DegreeOfMaturity == 0)
                {
                    DegreeOfMaturity entry = new DegreeOfMaturity(); _context.Add(entry); degreeOfMaturityTrans.Degreeofmaturity = entry.Id;
                }

                _context.Add(degreeOfMaturityTrans);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["Degreeofmaturity"] = new SelectList(_context.DegreeOfMaturity, "Id", "Id", degreeOfMaturityTrans.Degreeofmaturity);
            ViewData["Language"]         = new SelectList(_context.Languages, "Id", "Code", degreeOfMaturityTrans.Language);
            return(View(degreeOfMaturityTrans));
        }