public async Task <IActionResult> Edit(int id, [Bind("Id")] DegreeOfMaturity degreeOfMaturity) { if (id != degreeOfMaturity.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(degreeOfMaturity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DegreeOfMaturityExists(degreeOfMaturity.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(degreeOfMaturity)); }
public async Task <IActionResult> Create([Bind("Id")] DegreeOfMaturity degreeOfMaturity) { if (ModelState.IsValid) { _context.Add(degreeOfMaturity); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(degreeOfMaturity)); }
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)); }