Пример #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);
 }