public async Task <IActionResult> AtrelarEvento(GrupoEvento grupo) { //Recarrega os combos Util carregamentoCombo = ObtemComboGruposEventos(); if (!ModelState.IsValid) { ViewBag.ListaGrupos = carregamentoCombo.ListaGrupos; ViewBag.ListaEventos = carregamentoCombo.ListaEventos; return(View(grupo)); } var retorno = await _grupoAppService.AtrelarGrupoEvento(grupo); if (retorno != null) { ViewBag.Codigo = retorno.cdretorno; ViewBag.Mensagem = retorno.mensagem; ViewBag.ListaGrupos = carregamentoCombo.ListaGrupos; ViewBag.ListaEventos = carregamentoCombo.ListaEventos; TempData["Mensagem"] = retorno.mensagem; TempData["Codigo"] = retorno.cdretorno; if (retorno.cdretorno == 1) { return(View(grupo)); } } return(RedirectToAction("AtrelarEvento")); }
public IActionResult AtrelarEvento(GrupoEvento grupo) { if (!ModelState.IsValid) { return(View()); } var retorno = _grupoAppService.AtrelarGrupoEvento(grupo); if (retorno != null) { ViewBag.Codigo = retorno.cdretorno; ViewBag.Mensagem = retorno.mensagem; TempData["Mensagem"] = retorno.mensagem; TempData["Codigo"] = retorno.cdretorno; } return(RedirectToAction("AtrelarEvento")); }