예제 #1
0
        public void Editar(EstabelecimentoDTO estabelecimento)
        {
            var estab = _RepositorioEstabelecimento.Encontrar(estabelecimento.Id);

            estab.Modificar(estabelecimento.Nome, estabelecimento.NomeFantasia, estabelecimento.CNPJ, estabelecimento.Email, estabelecimento.Telefone,
                            _RepositorioCategoria.Encontrar(estabelecimento.IdCategoria), estabelecimento.Status);
            _RepositorioEstabelecimento.Salvar();
        }
예제 #2
0
        public void Novo(EstabelecimentoDTO estabelecimento)
        {
            var categoria = _RepositorioCategoria.Encontrar(estabelecimento.IdCategoria);

            var Estabelecimento = new Estabelecimento(estabelecimento.Nome, estabelecimento.NomeFantasia,
                                                      estabelecimento.CNPJ, estabelecimento.Email, estabelecimento.Telefone, categoria,
                                                      estabelecimento.Status);

            _RepositorioEstabelecimento.Adicionar(Estabelecimento);

            _RepositorioEstabelecimento.Salvar();
        }
        public ActionResult Delete(EstabelecimentoDTO estabelecimento)
        {
            try
            {
                _EstabelecimentoApp.Excluir(estabelecimento.Id);

                return(RedirectToAction("Index"));
            }
            catch (Exception e)
            {
                ViewBag.ExceptionError = e.Message;
                return(View());
            }
        }
 public ActionResult Create(EstabelecimentoDTO estabelecimento)
 {
     try
     {
         // TODO: Add insert logic here
         _EstabelecimentoApp.Novo(estabelecimento);
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         ViewBag.ErrorException = e.Message;
         CarregarCategorias();
         return(View(estabelecimento));
     }
 }
 public ActionResult Edit(EstabelecimentoDTO estabelecimento, Guid asdas)
 {
     try
     {
         estabelecimento.IdCategoria = asdas;
         // TODO: Add update logic here
         _EstabelecimentoApp.Editar(estabelecimento);
         return(RedirectToAction("Index"));
     }
     catch (Exception e)
     {
         ViewBag.ErrorException = e.Message;
         CarregarCategorias(asdas.ToString());
         return(View(estabelecimento));
     }
 }