public async Task <ActionResult <Customer> > ADDEditCustomer([FromBody] Customer customer)
        {
            if (customer == null || !ModelState.IsValid)
            {
                return(BadRequest("Invalid State"));
            }

            return(await _customerRep.ADDEditCustomer(customer));
        }
예제 #2
0
        public async Task <ActionResult <Customer> > ADDEditCustomer([FromBody] Customer customer)
        {
            if (customer == null || !ModelState.IsValid)
            {
                return(BadRequest("Invalid State"));
            }

            var existingItem = _customerRep.GetCustomerByID(customer.CustID);

            if (existingItem == null)
            {
                return(NotFound(ErrorCode.RecordNotFound.ToString()));
            }
            return(await _customerRep.ADDEditCustomer(customer));
        }