Пример #1
0
        public IActionResult Create([FromBody] CustomerToAdd customerToAdd)
        {
            var created = customersService.Create(customerToAdd);

            monitoring.CreateCustomer();

            return(new OkObjectResult(new CustomerResource
            {
                GlobalId = created.GlobalId,
                Name = created.Name,
                CreatedAt = created.CreatedAt,
                UpdatedAt = created.UpdatedAt
            }));
        }
        public IActionResult Create(CustomerFormModel customerModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(customerModel));
            }

            customers.Create(
                customerModel.Name,
                customerModel.BirthDate,
                customerModel.IsYoungDriver
                );

            return(RedirectToAction(nameof(All), new { order = "ascending" }));
        }
        public async Task <ActionResult <int> > Post(CustomerDto customer)
        {
            var id = await _customersService.Create(customer);

            return(Created($"/customers/{id}", id));
        }
Пример #4
0
 public Task <ActionResult <Customer> > Post([FromBody] CustomerCreateRequest request)
 {
     return(_customersService.Create(request).Convert <Customer>(this));
 }
 public async Task <OperationResult> Create([FromBody] CustomerFullModel customerPnCreateModel)
 {
     return(await _customersService.Create(customerPnCreateModel));
 }