public async Task <DataResult <int> > AlterarAvaliacaoAsync(int id, string disciplina, string materia, string descricao) { try { var retorno = await _avaliacaoService.AlterarAvaliacaoAsync(id, disciplina, materia, descricao); return(new DataResult <int>(retorno)); } catch (Exception ex) { return(new DataResult <int>(ex)); } }
public async Task <IActionResult> Edit(int id, [Bind("Materia,Descricao,IdDisciplina,Id")] Avaliacao avaliacao) { if (id != avaliacao.Id) { return(NotFound()); } if (ModelState.IsValid) { await _avaliacaoService.AlterarAvaliacaoAsync(avaliacao.Id, avaliacao.Materia, avaliacao.Descricao, avaliacao.IdDisciplina); return(RedirectToAction(nameof(Index))); } ViewData["IdDisciplina"] = new SelectList(await _disciplinaRepository.ListarTodosAsync(), "Id", "Id", avaliacao.IdDisciplina); return(View(avaliacao)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Disciplina,Materia,Descricao")] Avaliacao avaliacao) { if (id != avaliacao.Id) { return(NotFound()); } if (ModelState.IsValid) { await _avaliacaoService.AlterarAvaliacaoAsync(avaliacao.Id, avaliacao.Disciplina, avaliacao.Materia, avaliacao.Descricao); return(RedirectToAction(nameof(Index))); } return(View(avaliacao)); }