Example #1
0
        public async Task <IActionResult> Create(CreateOrderItemRequest request)
        {
            var mapped   = request.MapToDomainRequest(_mapper);
            var response = await _service.Create(mapped);

            return(StatusCode(response.Code, response));
        }
Example #2
0
        public IActionResult Post([FromBody] OrderItemDto orderItemDto)
        {
            var orderItem           = _mapper.Map <OrderItem>(orderItemDto);
            var createdOrderItem    = _orderItemService.Create(orderItem);
            var createdOrderItemDto = _mapper.Map <OrderItemDto>(createdOrderItem);

            return(StatusCode((int)HttpStatusCode.Created, createdOrderItemDto));
        }
 public IActionResult Create(OrderItem orderItem)
 {
     if (ModelState.IsValid)
     {
         _orderItemService.Create(orderItem);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(orderItem));
 }
        public ActionResult Create(OrderItemViewModel model)
        {
            if (!ModelState.IsValid)
            {
                Helpers.InvalidModelState(ModelState);
            }

            var itemId = _orderItemService.Create(model);

            return(Json(itemId));
        }
Example #5
0
 public ActionResult <OrderItem> PostOrderItem(OrderItem OrderItem)
 {
     OrderItemService.Create(OrderItem);
     return(CreatedAtAction("GetOrderItem", new { id = OrderItem.Id }, OrderItem));
 }
Example #6
0
 public IActionResult PostOrderItem([FromBody] OrderItem orderItem)
 {
     _orderItemService.Create(orderItem);
     return(Ok("success"));
 }