public async Task <ActionResult> CreateOrder(ManufacturingOrderForCreationDto order)
        {
            try
            {
                ManufacturingOrder orderEntity = mapper.Map <ManufacturingOrder>(order);

                Product product = await dbContext.Products.FindAsync(orderEntity.ProductId);

                if (product == null)
                {
                    return(NotFound("Provided product doesn't exists"));
                }

                dbContext.ManufacturingOrders.Add(orderEntity);
                await dbContext.SaveChangesAsync();

                ManufacturingOrder    orderToReturn = dbContext.ManufacturingOrders.Where(o => o.Id == orderEntity.Id).Include(oi => oi.Product).FirstOrDefault();
                ManufacturingOrderDto orderDto      = mapper.Map <ManufacturingOrderDto>(orderToReturn);

                return(CreatedAtAction(nameof(GetOrder), new { id = orderDto.Id }, orderDto));
            }
            catch
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
 public async Task <ManufacturingOrderDto> CreateOrder(ManufacturingOrderForCreationDto order)
 {
     try
     {
         return(await httpClient.PostJsonAsync <ManufacturingOrderDto>("api/manufacturingorders", order));
     }
     catch
     {
         return(null);
     }
 }