Exemple #1
0
        public void ShouldFindAnExistingCustomer()
        {
            var id          = Guid.Parse("199b9325-8c2b-468d-a1cc-9b6020192e0d");
            var queryresult = _sut.ItemExists(id);

            Assert.True(queryresult);
        }
Exemple #2
0
        public IActionResult UpdateCustomer(Guid id, [FromBody] CustomerForUpdateDto customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (_talaCustomerRepository.ItemExists(id))
            {
                return(NotFound());
            }

            var customerFromRepo = _talaCustomerRepository.Get(id);

            Mapper.Map(customer, customerFromRepo);

            _talaCustomerRepository.Update(customerFromRepo);

            if (_talaCustomerRepository.Save())
            {
                throw new Exception($"Updating ustomer {id} failed on save.");
            }

            return(NoContent());
        }