Beispiel #1
0
        public IActionResult Delete(int id)
        {
            using (var data = new ProcedimentoData())
                data.Delete(id);

            return(RedirectToAction("Index"));
        }
        public string SalvarProcedimento(out bool salvo)
        {
            string msg;

            Procedimento.Produtos = ListaDeProdutosAdd;

            NormalizaDataTime();

            if (NomeValido() == false)
            {
                msg   = "Nome do procedimento invalido!";
                salvo = false;
                return(msg);
            }

            if (Procedimento.Id == 0)
            {
                msg   = ProcedimentoData.CadastroDeNovoProcedimento(Procedimento);
                salvo = true;
            }
            else
            {
                msg   = ProcedimentoData.AlterarProcedimento(Procedimento);
                salvo = true;
            }
            return(msg);
        }
Beispiel #3
0
 public IActionResult Create()
 {
     using (var data = new ProcedimentoData())
     {
         return(View());
     }
 }
Beispiel #4
0
 public IActionResult Index()
 {
     using (var data = new ProcedimentoData())
     {
         return(View(data.Read()));
     }
 }
        public ProcedimentoViewModel(int id)
        {
            Procedimento = ProcedimentoData.PegarProcedimento(id);

            ListaDeProdutosAdd = new ObservableCollection <Produto>(Procedimento.Produtos);

            NomeDaTela = "> Editar Procedimento";

            CarregarHoraAgendada();
        }
Beispiel #6
0
        public IActionResult Create(Procedimento e)
        {
            if (!ModelState.IsValid)
            {
                return(View(e));
            }
            using (var data = new ProcedimentoData())
                data.Create(e);

            return(RedirectToAction("Index"));
        }
Beispiel #7
0
        public IActionResult Update(int id, Procedimento e)
        {
            e.Id = id;

            if (!ModelState.IsValid)
            {
                return(View(e));
            }

            using (var data = new ProcedimentoData())
                data.Update(e);

            return(RedirectToAction("Index"));
        }
Beispiel #8
0
        public IActionResult Create()
        {
            using (var data = new AnimalData())
            {
                ViewBag.Animal = data.Read();
            }

            using (var data = new VeterinarioData())
            {
                ViewBag.Veterinario = data.Read();
            }

            using (var data = new ProcedimentoData())
            {
                ViewBag.Procedimento = data.Read();
            }

            using (var data = new ConsultaData())
            {
                return(View());
            }
        }
Beispiel #9
0
 public IActionResult Update(int id)
 {
     using (var data = new ProcedimentoData())
         return(View(data.Read(id)));
 }