コード例 #1
0
 public ActionResult <Customer> PostCustomer([FromBody] sample_object.SampleCustomer cus)
 {
     try
     {
         Customer customer = new Customer(cus.Name, cus.Adress);
         if (CManager.ExistCustomerCheck(customer))
         {
             return(BadRequest("Customer already exists"));
         }
         CManager.AddCustomer(customer);
         return(CreatedAtAction(nameof(GetCustomer), new { id = customer.ID }, customer));
     }
     catch
     {
         throw new Exception("invalid values");
     }
 }