Exemplo n.º 1
0
        public void ShouldAddCustomer()
        {
            var toAdd = new TalaCustomer
            {
                BusinessName = "xxx"
            };

            _sut.Add(toAdd);
            _sut.Save();

            var queryresult = _sut.GetAll("x").ToList();

            Assert.Single(queryresult);
        }
Exemplo n.º 2
0
        public IActionResult CreateCustomer([FromBody] CustomerForCreationDto customer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var customerEntity = Mapper.Map <TalaCustomer>(customer);

            _talaCustomerRepository.Add(customerEntity);
            if (!_talaCustomerRepository.Save())
            {
                throw new Exception("Creating a talaCustomer failed on save");
            }

            return(NoContent());
        }