Example #1
0
        public ActionResult Index(Racao racao)
        {
            RacoesMessageId message = RacoesMessageId.Error;
            int             id      = 0;

            try
            {
                if (racao != null)
                {
                    if (racao.Id > 0)
                    {
                        racao.Save();
                        id      = racao.Id;
                        message = RacoesMessageId.SaveSucess;
                    }
                    else
                    {
                        racao.Criador = Helpers.Current.CriadorId;
                        racao.Add();
                        id = racao.Id;
                        Helpers.Current.Racoes = Racoes.ListByCriador(Helpers.Current.CriadorId);
                        message = RacoesMessageId.AddSuccess;
                    }
                }
            }
            catch (Exception)
            {
                return(RedirectToAction("Index", new { message = VacinaMessageId.Error }));
            }
            return(RedirectToAction("Index", new { RacaoId = id, message = message }));
        }
Example #2
0
 public PartialViewResult Listar()
 {
     ViewBag.Racoes = Racoes.ListByCriador(Helpers.Current.CriadorId);
     return(PartialView());
 }