Пример #1
0
        public ActionResult <Customer> AddCustomer([FromBody] Customer customer)
        {
            if (!customer.IsValid())
            {
                return(BadRequest(customerInvalidMessage));
            }

            var res = _customerService.AddEditCustomer(customer);

            if (res.Exists)
            {
                return(BadRequest("Customer already exists."));
            }

            return(Created(nameof(AddCustomer), res.Customer));
        }
Пример #2
0
 public IActionResult AddEditCustomer([FromBody] NewCustomerRequest request)
 {
     try
     {
         _customerservice.AddEditCustomer(request, UserId, BranchId);
         return(Ok(HttpStatusCode.Created));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
Пример #3
0
 public int AddEditCustomer(CustomerViewModel customer)
 {
     return(_service.AddEditCustomer(customer));
 }