// GET: api/Order/orderTable?ID=10248 public HttpResponseMessage Get(int ID) { HttpResponseMessage resp; Orders ord = new Orders(); var data = _ordersDAO.Get(ID); ord.CustomerID = data.CustomerID; ord.EmployeeID = data.EmployeeID; ord.OrderDate = data.OrderDate; ord.ShipName = data.ShipName; ord.ShipAddress = data.ShipAddress; ord.ShipCity = data.ShipCity; ord.ShipRegion = data.ShipRegion; ord.ShipPostalCode = data.ShipPostalCode; ord.ShipCountry = data.ShipCountry; var result = ord; resp = Request.CreateResponse(HttpStatusCode.OK, result); return(resp); }
public IActionResult Get(int ID) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var data = _ordersDAO.Get(ID); if (data == null) { return(NotFound(data)); } return(Ok(data)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }