// GET: AgendamentoViewModels/Delete/5 public async Task <IActionResult> Delete(Guid id) { if (id == null) { return(NotFound()); } var agendamentoViewModel = _mapper.Map <AgendamentoViewModel>(await _agendamentoRepository.ObterPorId(id)); if (agendamentoViewModel == null) { return(NotFound()); } await _agendamentoService.Remover(id); return(View(agendamentoViewModel)); }
public async Task <IActionResult> DeleteConfirmed(Guid id) { var agendamento = await ObterAgendamento(id); if (agendamento == null) { return(NotFound()); } await _agendamentoService.Remover(id); if (!OperacaoValida()) { return(View(agendamento)); } TempData["Sucesso"] = "Agendamento excluído com sucesso!"; return(RedirectToAction("Index")); }
public void Remover(long id) { agendamentoService.Remover(id); }