Exemplo n.º 1
0
 public ActionResult Update(int id)
 {
     try
     {
         regranegocioTime = new regranegocioTime();
         var time = regranegocioTime.Pesquisar().Find(t => t.TimeID == id);
         return(View(time));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
        public ActionResult Update(int id, Time objTime)
        {
            try
            {
                regranegocioTime = new regranegocioTime();

                regranegocioTime.Atualizar(objTime);

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                return(View("Index"));
            }
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            try
            {
                regranegocioTime = new regranegocioTime();

                var lstTimes = regranegocioTime.Pesquisar();

                ModelState.Clear();

                return(View(lstTimes));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        public ActionResult Create(Time objTime)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    regranegocioTime = new regranegocioTime();


                    if (regranegocioTime.Adicionar(objTime))
                    {
                        ViewBag.Mensagem = "Time Cadastrado com Sucesso.";
                    }
                }

                return(View());
            }
            catch (Exception)
            {
                return(View("Index"));
            }
        }
Exemplo n.º 5
0
        public ActionResult Delete(int id)
        {
            Time objTime = null;

            try
            {
                regranegocioTime = new regranegocioTime();
                objTime          = new Time();

                objTime.TimeID = id;

                if (regranegocioTime.Deletar(objTime))
                {
                    ViewBag.Mensagem = "Time Excluido com Sucesso.";
                }


                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                return(View("Index"));
            }
        }