예제 #1
0
        // POST: api/Customer
        public HttpResponseMessage Post([FromBody] CustomerModel customer)
        {
            int customerId = _customerServices.Create(customer);

            return(customerId > 0
                ? Request.CreateResponse(HttpStatusCode.OK, customerId)
                : Request.CreateResponse(HttpStatusCode.Conflict, "Customer with this name exists."));
        }
 public IActionResult _PVCreate(Customer customer)
 {
     try
     {
         if (ModelState.IsValid)
         {
             services.Create(customer);
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         ViewBag.Msg = ex.Message;
     }
     return(View());
 }
예제 #3
0
        public ActionResult <Guid> CreateCustomer(CustomerCreateRequestModel customerRequestModel)
        {
            var customerModel = _customerServices.Create(new CustomerModel(customerRequestModel));

            return(customerModel.Id);
        }
예제 #4
0
 public CustomerModel CreateItem([FromBody] CustomerModel model)
 {
     _customerServices.Create(model);
     return(model);
 }