Пример #1
0
        // GET: FarmaciaController/Edit/5
        public ActionResult Edit(int id)
        {
            Farmacia      farmacia      = _farmaciaService.Obter(id);
            FarmaciaModel farmaciaModel = _mapper.Map <FarmaciaModel>(farmacia);

            return(View(farmaciaModel));
        }
Пример #2
0
        public ActionResult Edit(int id, FarmaciaModel farmaciaModel)
        {
            if (ModelState.IsValid)
            {
                var farmacia = _mapper.Map <Farmacia>(farmaciaModel);
                _farmaciaService.Editar(farmacia);
            }

            return(RedirectToAction(nameof(Index)));
        }
Пример #3
0
        public ActionResult CreateSolicitacaoFarmacia(FarmaciaModel farmaciaModel)
        {
            if (ModelState.IsValid)
            {
                var farmacia = _mapper.Map <Farmacia>(farmaciaModel);
                farmacia.Status = "INATIVA";
                _farmaciaService.Inserir(farmacia);
            }

            return(RedirectToAction(nameof(Index)));
        }
Пример #4
0
        public void DetailsTest()
        {
            // Act
            var result = controller.Details(1);

            // Assert
            Assert.IsInstanceOfType(result, typeof(ViewResult));
            ViewResult viewResult = (ViewResult)result;

            Assert.IsInstanceOfType(viewResult.ViewData.Model, typeof(FarmaciaModel));
            FarmaciaModel autorModel = (FarmaciaModel)viewResult.ViewData.Model;

            Assert.AreEqual("Machado de Assis", autorModel.Nome);
            Assert.AreEqual(DateTime.Parse("18390621"), autorModel.Cnpj);
        }