Ejemplo n.º 1
0
        public Orders AddOrders([FromBody] OrderInput Input)
        {
            var modelInput = new Orders
            {
                UserId    = Input.UserId,
                ProductId = Input.ProductId
            };
            var result = _ordersService.AddOrders(modelInput);

            return(result);
        }
Ejemplo n.º 2
0
        public ActionResult Post([FromBody] OrdersRequestModel ordersRequest)
        {
            IPAddress remoteIpAddress = Request.HttpContext.Connection.RemoteIpAddress;

            (bool isValid, int OrderID)ordersResponse = _orderService.AddOrders(ordersRequest, remoteIpAddress.ToString());
            if (ordersResponse.isValid)
            {
                return(Ok($"{BaseURL}/{ordersResponse.OrderID}"));
            }
            else
            {
                return(BadRequest());
            }
        }