Ejemplo n.º 1
0
        public ActionResult Create(MedicamentoModel medicamentoModel)
        {
            if (ModelState.IsValid)
            {
                var medicamento = _mapper.Map <Medicamento>(medicamentoModel);
                _medicamentoService.Inserir(medicamento);
            }

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 2
0
        public void InserirTest()
        {
            medicamentoService.Inserir(
                new Medicamento
            {
                IdMedicamento   = 4,
                Nome            = "Remédio para pulgas",
                IdEspecieAnimal = 1
            }
                );
            Assert.AreEqual(4, medicamentoService.ObterTodos().Count());
            var medicamento = medicamentoService.Obter(4);

            Assert.AreEqual("Remédio para pulgas", medicamento.Nome);
            Assert.AreEqual(1, medicamento.IdEspecieAnimal);
        }