public async Task <IActionResult> Create(CreateOrderItemRequest request) { var mapped = request.MapToDomainRequest(_mapper); var response = await _service.Create(mapped); return(StatusCode(response.Code, response)); }
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)); }
public ActionResult <OrderItem> PostOrderItem(OrderItem OrderItem) { OrderItemService.Create(OrderItem); return(CreatedAtAction("GetOrderItem", new { id = OrderItem.Id }, OrderItem)); }
public IActionResult PostOrderItem([FromBody] OrderItem orderItem) { _orderItemService.Create(orderItem); return(Ok("success")); }