title: Getting HTTP 404 error in a POST request - C#
body: <p>I am trying to create new customerId and orderId.
  Which then will display a new order and retrieve code 201 for created.
  I can't see why the code is not working. Is there something I'm missing?</p>
  
  <p>Been working on this for several days with no luck.
  Hopefully you can see where I have gone wrong.</p>
  
  <p>Still new to programming and really appreciate your help.</p>
  
  <p>Code is below:</p>
  
  <p><strong><em>Models:</em></strong></p>
  
  <pre><code>using System.Collections.Generic;
  
  namespace Project.Models
  {
      public class Customer
      {
         public string CustomerId { get; set; }
         public string FirstName { get; set; }
         public string LastName { get; set; }
         public string DateOfBirth { get; set; }
      }
  
     public class Order
     {
         public string OrderId { get; set; }
         public string Product { get; set; }
         public string Status { get; set; }
         public double Price { get; set; }
     }
  
      public class CustomerOrder
      {
        public string CustomerId {get; set;}
        public string OrderId { get; set; }
      } 
  }
  </code></pre>
  
  <hr>
  
  <p><strong><em>Repositories:</em></strong></p>
  
  <pre><code>using System.Collections.Generic;
  using System.Linq;
  using Project.Models;
  using System.Net;
  using System.Collections.Specialized;
  using System.Text;
  
  
  namespace Project.Repositories
  {
     public class OrderRepository
     {
  
         private static List&lt;Order&gt; _Orders;
         private static List&lt;CustomerOrder&gt; _CustomerOrder;
  
         static OrderRepository()
         {
             _Orders = new List&lt;Order&gt;();
             _CustomerOrder= new List&lt;CustomerOrder&gt;();
  
             _Orders.Add(new Order
             {
                 OrderId = "124",
                 Product= "Shirts",
                 Status= "On it's way",
                 Price= 100.20,
             });
  
             _Orders.Add(new Order
             {
                 OrderId= "122",
                 Product= "Pants",
                 Status= "Not ready",
                 Price= 300.30,
             });
  
             _Orders.Add(new Order
             {
                 OrderId= "143",
                 Product= "Deadpool",
                 Status= "On it's way",
                 Price= 6.20,
             });
  
             _Orders.Add(new Order
             {
                 OrderId= "156",
                 Product= "Socks",
                 Status= "Not ready",
                 Price= 3.30,
             });
  
             _CustomerOrder.Add(new CustomerOrder
             {
                 CustomerId = "578",
                 OrderId = "156",
             });
  }
  
  public static void SaveNewCustomerOrder(string customerId, string orderId, CustomerOrder customerOrder)
  {
      order.CustomerID = customerId;
      order.OrderId= orderId;
      Order.Add(order);
  }
  </code></pre>
  
  <hr>
  
  <p><strong><em>Controllers:</em></strong></p>
  
  <p>OrderController.cs:</p>
  
  <pre><code>using System.Collections.Generic;
  using System.Linq;
  using Microsoft.AspNetCore.Mvc;
  using Project.Models;
  using Project.Repositories;
  
  namespace Project.Controllers
  {
     public class OrderController : Controller
     {
        [HttpPost("customers/{customerId}/orders/{orderId}/overview")]
         public IActionResult Post([FromRoute] string customerId, string orderId, [FromBody] CustomerOrder customerOrder)
         {
            OrderRepository.SaveNewCustomerOrder(customerId, orderId, customerOrder);
  
            return Ok();
         }
      }
   }
  </code></pre>
  
  <hr>