// GET api/issues/id public IssueDTO GetById(int id) { Issue someIssue = issueRepo.GetById(id); if (someIssue == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } IssueDTO someIssueDTO = new IssueDTO(someIssue); return(someIssueDTO); }
public void placeOrder(int issueID, Int16 quantity, int supplierID) { Issue issue = new Issue(); issue = issueRepo.GetById(issueID); var someissueID = issue.IssueID; //Check for supplier quote SupplierQuote theQuote = supplierQuoteRepo.getSupplierQuote(issueID, supplierID); Supplier theSupplier = supplierRepo.GetById(theQuote.SupplierID); Order newOrder = new Order(); newOrder.IssueID = issue.IssueID; newOrder.OrderDate = DateTime.Now; newOrder.QtyOrdered = quantity; newOrder.Total = quantity * theQuote.Price; newOrder.SupplierID = theSupplier.SupplierID; //These next few fields and their info must come from the supplier API newOrder.ShipmentRef = null; newOrder.ShipmentDate = null; newOrder.DeliveryStatus = "Pending Payment"; orderRepo.Add(newOrder); }