public ActionResult <TypeInsuranceVM> AddTypeInsurance([FromBody] TypeInsuranceDTO typeInsuranceDTO)
        {
            var typeInsurance = _mapper.Map <TypeInsurance>(typeInsuranceDTO);

            _typeInsuranceService.AddTypeInsurance(typeInsurance);
            _typeInsuranceService.SaveChanges();
            _log.Save(User?.Identity.Name, "Dodano rodzaj ubezpieczenia", GetType().Name);
            return(Ok());
        }
Esempio n. 2
0
        public void UpdateTypeInsuranceTests()
        {
            //Arrange
            var typeinsuranceController       = this.CreateTypeInsuranceController();
            TypeInsuranceDTO typeInsuranceDTO = new TypeInsuranceDTO();
            int id = 0;
            //Act
            var result = typeinsuranceController.UpdateTypeInsurance(
                typeInsuranceDTO, id);

            //Assert
            _mocktypeInsuranceService.VerifyAll();
        }
Esempio n. 3
0
        public void AddTypeInsuranceTests()
        {
            // Arrange
            var typeinsuranceController       = this.CreateTypeInsuranceController();
            TypeInsuranceDTO typeInsuranceDTO = new TypeInsuranceDTO();
            //// Act
            var result = typeinsuranceController.AddTypeInsurance(typeInsuranceDTO);

            //Assert
            _mocktypeInsuranceService.VerifyAll();
            result.Should().NotBeNull();
            result.Result.Should().BeOfType <OkResult>();
        }
        public ActionResult UpdateTypeInsurance([FromBody] TypeInsuranceDTO typeInsuranceDTO, int id)
        {
            var uTypeInsurance = _typeInsuranceService.FindById(id);

            if (uTypeInsurance == null)
            {
                return(NotFound());
            }
            _mapper.Map(typeInsuranceDTO, uTypeInsurance);
            _typeInsuranceService.UpdateTypeInsurance(uTypeInsurance);
            _typeInsuranceService.SaveChanges();
            _log.Save(User?.Identity.Name, "Edytowano rodzaj ubezpieczenia", GetType().Name);
            return(Ok());
        }