public ActionResult Index(Vacina vacina) { VacinaMessageId message = VacinaMessageId.Error; int id = 0; try { if (vacina != null) { if (vacina.Id > 0) { vacina.Save(); id = vacina.Id; message = VacinaMessageId.SaveSucess; } else { vacina.Criador = Helpers.Current.CriadorId; vacina.Add(); id = vacina.Id; Helpers.Current.Vacinas = Vacinas.ListByCriador(Helpers.Current.CriadorId); message = VacinaMessageId.AddSuccess; } } } catch (Exception) { return(RedirectToAction("Index", new { message = VacinaMessageId.Error })); } return(RedirectToAction("Index", new { VacinaId = id, message = message })); }
public PartialViewResult Listar() { ViewBag.Vacinas = Vacinas.ListByCriador(Helpers.Current.CriadorId); return(PartialView()); }