コード例 #1
0
        public IActionResult AddCustomer([FromBody] CustomerForCreationDto customer)
        {
            if (customer == null)
            {
                return(BadRequest());
            }

            var customerForPost = Mapper.Map <Customer>(customer);

            _shopRepository.AddCustomer(customerForPost);


            if (!_shopRepository.Save())
            {
                return(StatusCode(500, "An internal server error occured. Please try again!"));
            }

            return(StatusCode(201));
        }