public void FindShipmentContentModelTest() { var testUser = GetTestUser(); var testCompany = GetTestCompany(testUser, true); var testShipment = GetTestShipment(testCompany, testUser, 5); var newItem = GetTestPurchaseOrderHeader(testCompany, testUser, RandomInt(10, 20)); var model = ShipmentService.AddPurchaseOrder(testCompany, testUser, testShipment, newItem); var test = ShipmentService.FindShipmentContentModel(model.Id); AreEqual(model, test); }
public ActionResult EditContent(int shipmentId, int contentId) { // Called when a user clicks to edit an order - we // go straight to the lines screen var contentModel = ShipmentService.FindShipmentContentModel(contentId); if (contentModel != null) { return(RedirectToAction("Edit", "Purchasing", new { area = "Purchasing", id = $"{contentModel.PurchaseOrderHeaderId}" })); } else { var model = new EditShipmentViewModel(); model.Shipment = ShipmentService.FindShipmentModel(shipmentId, CurrentCompany, true); prepareEditModel(model, model.Shipment); model.LGS = ShipmentService.LockShipment(model.Shipment); model.SetRecordError("ShipmentContent", contentId, true); return(View("Edit", model)); } }