public async Task <IActionResult> Edit(int id, [Bind("Id,NomeCurso,Descricao,Trabalho")] Curso cursos) { if (id != cursos.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cursos); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CursosExists(cursos.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cursos)); }
public async Task <IActionResult> Create([Bind("Id,NomeTrabalho")] Trabalho trabalho) { if (ModelState.IsValid) { _context.Add(trabalho); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(trabalho)); }
public async Task InsertAsync(Curso obj) { _context.Add(obj); await _context.SaveChangesAsync(); }